summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/public/mojom/page/page.mojom
blob: 4320f0ea1f2db6599787bea5d9576c42430b5ccf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module blink.mojom;
import "mojo/public/mojom/base/time.mojom";
import "third_party/blink/public/mojom/page/page_visibility_state.mojom";

enum PagehideDispatch {
  // We haven't dispatched pagehide and should do so when appropriate.
  kNotDispatched,
  // We've dispatched pagehide with persisted == false.
  kDispatchedNotPersisted,
  // We've dispatched pagehide with persisted == true.
  kDispatchedPersisted
};

// We need this structure to be able to atomically update the state of the page
// to avoid it being in an inconsistent state (e.g. frozen but visible).
// TODO(yuzus): Replace
// third_party/blink/renderer/platform/scheduler/public/page_lifecycle_state.h
// with this struct.
struct PageLifecycleState {
  bool is_frozen;
  PageVisibilityState visibility;
  bool is_in_back_forward_cache;
  PagehideDispatch pagehide_dispatch;
};

// Additional parameters to send with SetPageLifecycleState calls when we're
// restoring a page from the back-forward cache.
struct PageRestoreParams {
  // Timestamp of the start of the navigation restoring this entry from the
  // back-forward cache.
  mojo_base.mojom.TimeTicks navigation_start;

  // The offset in the session history list for the page to be restored.
  int32 pending_history_list_offset;

  // Total size of the session history list.
  int32 current_history_list_length;
};

// Used for broadcast messages from browser to renderer for messages that need
// to go to all blink::WebViewImpls for a given content::WebContents. There may
// be multiple blink::WebViewImpls when there are out-of-process iframes.
interface PageBroadcast {
  // Notifies the renderer about a change in the lifecycle state of the page.
  SetPageLifecycleState(
      PageLifecycleState state,
      PageRestoreParams? page_restore_params) => ();

  // Notifies the renderer when audio is started or stopped.
  AudioStateChanged(bool is_audio_playing);

  // Notifies renderers when a portal web contents is activated or if a
  // web contents is adopted as a portal.
  SetInsidePortal(bool is_inside_portal);
};