Avi Drissman | 4e1b7bc3 | 2022-09-15 14:03:50 | [diff] [blame^] | 1 | // Copyright 2014 The Chromium Authors |
ben | 76f52b24 | 2016-06-18 05:42:48 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | module content.mojom; |
| 6 | |
Dave Tapuska | fc4adbae | 2020-12-02 22:08:59 | [diff] [blame] | 7 | import "cc/mojom/browser_controls_state.mojom"; |
Arthur Hemery | 9c03573 | 2019-01-07 16:12:41 | [diff] [blame] | 8 | import "content/common/frame_messages.mojom"; |
Jeremy Roman | 62fee22 | 2019-07-09 17:34:14 | [diff] [blame] | 9 | import "content/common/native_types.mojom"; |
Arthur Hemery | d3011f6 | 2018-05-30 10:38:44 | [diff] [blame] | 10 | import "content/common/navigation_client.mojom"; |
Miyoung Shin | 072d405 | 2020-07-13 07:52:44 | [diff] [blame] | 11 | import "content/common/web_ui.mojom"; |
Jiewei Qian | cc639a66 | 2022-04-01 02:43:34 | [diff] [blame] | 12 | import "content/public/common/extra_mojo_js_features.mojom"; |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame] | 13 | import "content/public/common/window_container_type.mojom"; |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 14 | import "ipc/constants.mojom"; |
Mario Sanchez Prada | 13bbad5 | 2020-06-01 18:12:29 | [diff] [blame] | 15 | import "mojo/public/mojom/base/file_path.mojom"; |
Ken Rockot | 8b447d7 | 2018-02-03 20:30:47 | [diff] [blame] | 16 | import "mojo/public/mojom/base/string16.mojom"; |
Dominic Mazzoni | 77d0aba | 2021-01-14 09:42:16 | [diff] [blame] | 17 | import "mojo/public/mojom/base/time.mojom"; |
Oksana Zhuravlova | 34579e91 | 2018-03-23 00:18:49 | [diff] [blame] | 18 | import "mojo/public/mojom/base/unguessable_token.mojom"; |
Hajime Hoshi | 35ad74f | 2019-03-07 08:38:05 | [diff] [blame] | 19 | import "mojo/public/mojom/base/values.mojom"; |
Bo Liu | b5e79d9 | 2021-06-12 01:40:41 | [diff] [blame] | 20 | import "skia/public/mojom/skcolor.mojom"; |
arthursonzogni | 42eabe01 | 2020-01-17 15:55:56 | [diff] [blame] | 21 | import "services/network/public/mojom/content_security_policy.mojom"; |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 22 | import "services/network/public/mojom/url_loader.mojom"; |
Dave Tapuska | 2a6046a | 2021-03-01 22:42:52 | [diff] [blame] | 23 | import "services/network/public/mojom/url_loader_factory.mojom"; |
| 24 | import "services/network/public/mojom/url_request.mojom"; |
arthursonzogni | 42eabe01 | 2020-01-17 15:55:56 | [diff] [blame] | 25 | import "services/network/public/mojom/url_response_head.mojom"; |
Ken Rockot | 543f5e3 | 2018-02-04 02:13:50 | [diff] [blame] | 26 | import "services/service_manager/public/mojom/interface_provider.mojom"; |
Miyoung Shin | 99505dd | 2019-07-27 12:45:35 | [diff] [blame] | 27 | import "services/viz/public/mojom/compositing/surface_id.mojom"; |
Dominic Farolino | 12e06d7 | 2022-08-05 02:29:49 | [diff] [blame] | 28 | import "third_party/blink/public/mojom/associated_interfaces/associated_interfaces.mojom"; |
Blink Reformat | a30d423 | 2018-04-07 15:31:06 | [diff] [blame] | 29 | import "third_party/blink/public/mojom/blob/blob_url_store.mojom"; |
Dave Tapuska | 4e60c23 | 2020-11-05 15:49:32 | [diff] [blame] | 30 | import "third_party/blink/public/mojom/browser_interface_broker.mojom"; |
Julie Jeongeun Kim | 42a90df | 2019-03-20 23:13:10 | [diff] [blame] | 31 | import "third_party/blink/public/mojom/commit_result/commit_result.mojom"; |
Minggang Wang | b9f3fa9 | 2021-07-01 15:30:31 | [diff] [blame] | 32 | import "third_party/blink/public/mojom/conversions/conversions.mojom"; |
Lowell Manners | f03ea5a | 2019-04-23 11:47:58 | [diff] [blame] | 33 | import "third_party/blink/public/mojom/devtools/console_message.mojom"; |
Dominic Farolino | 6d261e0 | 2021-08-18 15:12:30 | [diff] [blame] | 34 | import "third_party/blink/public/mojom/fenced_frame/fenced_frame.mojom"; |
Dave Tapuska | 4e60c23 | 2020-11-05 15:49:32 | [diff] [blame] | 35 | import "third_party/blink/public/mojom/frame/frame_owner_properties.mojom"; |
| 36 | import "third_party/blink/public/mojom/frame/frame_policy.mojom"; |
Gyuyoung Kim | c16e52e9 | 2021-03-19 02:45:37 | [diff] [blame] | 37 | import "third_party/blink/public/mojom/frame/frame_replication_state.mojom"; |
Dave Tapuska | d6703f91 | 2019-01-31 23:13:11 | [diff] [blame] | 38 | import "third_party/blink/public/mojom/frame/lifecycle.mojom"; |
Antonio Sartori | 7f809cc7 | 2020-10-30 07:47:20 | [diff] [blame] | 39 | import "third_party/blink/public/mojom/frame/policy_container.mojom"; |
Lei Zhang | 96fce97 | 2022-08-05 23:15:07 | [diff] [blame] | 40 | import "third_party/blink/public/mojom/frame/remote_frame.mojom"; |
Dave Tapuska | 4e60c23 | 2020-11-05 15:49:32 | [diff] [blame] | 41 | import "third_party/blink/public/mojom/frame/tree_scope_type.mojom"; |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 42 | import "third_party/blink/public/mojom/loader/referrer.mojom"; |
Antonio Sartori | 6984c74 | 2021-08-26 08:03:41 | [diff] [blame] | 43 | import "third_party/blink/public/mojom/navigation/navigation_policy.mojom"; |
Minggang Wang | ee5af39 | 2020-02-05 02:55:28 | [diff] [blame] | 44 | import "third_party/blink/public/mojom/loader/resource_load_info.mojom"; |
Hiroki Nakagawa | 75375834 | 2018-12-27 04:13:49 | [diff] [blame] | 45 | import "third_party/blink/public/mojom/loader/url_loader_factory_bundle.mojom"; |
Yuzu Saijo | aae9170 | 2019-03-13 07:38:05 | [diff] [blame] | 46 | import "third_party/blink/public/mojom/messaging/transferable_message.mojom"; |
Minggang Wang | b9f3fa9 | 2021-07-01 15:30:31 | [diff] [blame] | 47 | import "third_party/blink/public/mojom/navigation/navigation_params.mojom"; |
Yuzu Saijo | d46f498a | 2020-08-04 02:56:22 | [diff] [blame] | 48 | import "third_party/blink/public/mojom/page/page.mojom"; |
Tommy Steimel | 991916c4 | 2022-06-24 20:59:57 | [diff] [blame] | 49 | import "third_party/blink/public/mojom/picture_in_picture_window_options/picture_in_picture_window_options.mojom"; |
Sharon Yang | 2abe198 | 2021-10-01 15:56:34 | [diff] [blame] | 50 | import "third_party/blink/public/mojom/widget/platform_widget.mojom"; |
Dave Tapuska | 8499eec | 2020-03-16 17:54:30 | [diff] [blame] | 51 | import "third_party/blink/public/mojom/page/widget.mojom"; |
Lucas Furukawa Gadani | 89a7418 | 2019-01-10 19:33:22 | [diff] [blame] | 52 | import "third_party/blink/public/mojom/portal/portal.mojom"; |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 53 | import "third_party/blink/public/mojom/renderer_preferences.mojom"; |
Hiroki Nakagawa | cdbc791 | 2018-11-30 11:30:05 | [diff] [blame] | 54 | import "third_party/blink/public/mojom/service_worker/controller_service_worker.mojom"; |
Hiroki Nakagawa | 077f2096 | 2020-05-15 08:04:44 | [diff] [blame] | 55 | import "third_party/blink/public/mojom/service_worker/service_worker_container.mojom"; |
Chris Hamilton | a46b1544 | 2020-07-31 14:38:56 | [diff] [blame] | 56 | import "third_party/blink/public/mojom/tokens/tokens.mojom"; |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 57 | import "third_party/blink/public/mojom/webpreferences/web_preferences.mojom"; |
Dave Tapuska | 9a31f41 | 2020-07-20 17:01:28 | [diff] [blame] | 58 | import "third_party/blink/public/mojom/widget/visual_properties.mojom"; |
Julie Jeongeun Kim | 42a90df | 2019-03-20 23:13:10 | [diff] [blame] | 59 | import "third_party/blink/public/mojom/window_features/window_features.mojom"; |
Mario Sanchez Prada | 5d7f1ac | 2020-07-16 17:18:40 | [diff] [blame] | 60 | import "ui/accessibility/mojom/ax_tree_update.mojom"; |
Julie Jeongeun Kim | 2b1d45a | 2019-06-28 23:37:54 | [diff] [blame] | 61 | import "ui/base/mojom/window_open_disposition.mojom"; |
Miyoung Shin | 87943f50 | 2019-07-26 13:31:58 | [diff] [blame] | 62 | import "ui/gfx/geometry/mojom/geometry.mojom"; |
Yoshisato Yanagisawa | 66845bf | 2022-05-12 04:04:02 | [diff] [blame] | 63 | import "url/mojom/scheme_host_port.mojom"; |
Kevin McNee | ea7f3b8 | 2020-02-27 21:42:32 | [diff] [blame] | 64 | import "url/mojom/url.mojom"; |
ben | 76f52b24 | 2016-06-18 05:42:48 | [diff] [blame] | 65 | |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 66 | // A View (i.e. a "main frame") can be created for a few different cases, these |
| 67 | // values are used to specify which it is. |
| 68 | enum ViewWidgetType { |
| 69 | // A standard view that's the top-level widget in a frame hierarchy. |
| 70 | kTopLevel, |
| 71 | // A GuestView used to render contents inside a <webview> element. |
| 72 | kGuestView, |
| 73 | // A view used to render contents inside a <portal> element. |
Dave Tapuska | efc4936a | 2021-10-05 20:47:10 | [diff] [blame] | 74 | kPortal, |
| 75 | // A view used to render contents inside a <fencedframe> element. |
| 76 | kFencedFrame |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 77 | }; |
| 78 | |
Kevin McNee | 43fe829 | 2021-10-04 22:59:41 | [diff] [blame] | 79 | // The type of the frame owner element for a child frame. In cross-process |
| 80 | // frames, this would be the type of the HTMLFrameOwnerElement for the remote |
| 81 | // child frame in the parent process. Note that only HTMLFrameOwnerElements for |
| 82 | // which CreateChildFrame is used are included here. Other |
| 83 | // HTMLFrameOwnerElements such as portals do not use this. |
| 84 | enum ChildFrameOwnerElementType { |
| 85 | kIframe, |
| 86 | kObject, |
| 87 | kEmbed, |
| 88 | kFrame, |
| 89 | // Note that only Fenced Frames based on Shadow DOM may create child frames. |
| 90 | // See crbug.com/1123606. |
| 91 | kFencedframe |
| 92 | }; |
| 93 | |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 94 | struct CreateViewParams { |
| 95 | // Renderer-wide preferences. |
| 96 | blink.mojom.RendererPreferences renderer_preferences; |
| 97 | |
| 98 | // Preferences for this view. |
| 99 | blink.mojom.WebPreferences web_preferences; |
| 100 | |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 101 | // The session storage namespace ID this view should use. |
| 102 | string session_storage_namespace_id; |
| 103 | |
Anton Bikineev | f62d1bf | 2021-05-15 17:56:07 | [diff] [blame] | 104 | // The frame token of the opener frame if one exists, or absl::nullopt |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 105 | // otherwise. |
Chris Hamilton | 2ea2031 | 2021-02-24 17:20:14 | [diff] [blame] | 106 | blink.mojom.FrameToken? opener_frame_token; |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 107 | |
Daniel Cheng | 4daa5122 | 2021-02-21 07:20:11 | [diff] [blame] | 108 | // Information that needs to be replicated to the view's main frame, e.g. |
| 109 | // frame name and sandbox flags. |
Gyuyoung Kim | c16e52e9 | 2021-03-19 02:45:37 | [diff] [blame] | 110 | blink.mojom.FrameReplicationState replication_state; |
Daniel Cheng | 4daa5122 | 2021-02-21 07:20:11 | [diff] [blame] | 111 | |
| 112 | // Used for devtools instrumentation and trace-ability. The token is shared |
| 113 | // across all frames (local or remotes) representing the same logical frame |
| 114 | // tree node, and is used by Blink and content to tag calls and requests for |
| 115 | // instrumentation purposes, allowing them to be attributed to a context |
| 116 | // frame. |
| 117 | // |
| 118 | // Must not be used to look up a RenderFrameHostImpl or RenderFrameProxyHost |
| 119 | // in the browser process, as the token is shared, making the mapping |
| 120 | // ambiguous and non-authoritative. |
| 121 | mojo_base.mojom.UnguessableToken devtools_main_frame_token; |
| 122 | |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 123 | CreateMainFrameUnion main_frame; |
| 124 | |
Dave Tapuska | 2cf1f53 | 2022-08-10 15:30:49 | [diff] [blame] | 125 | // Whether the `blink::WebView` should initially be hidden. |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 126 | bool hidden; |
| 127 | |
Dave Tapuska | 2cf1f53 | 2022-08-10 15:30:49 | [diff] [blame] | 128 | // Prerender2: Whether the `blink::WebView` is for a prerendered page. |
Matt Falkenhagen | 84e9a9b | 2021-07-13 23:12:54 | [diff] [blame] | 129 | bool is_prerendering; |
| 130 | |
Dave Tapuska | 2cf1f53 | 2022-08-10 15:30:49 | [diff] [blame] | 131 | // When true, all RenderWidgets under this `blink::WebView` will never be |
| 132 | // shown to the user, and thus never composited, and will not need to produce |
| 133 | // pixels for display. This allows the renderer to optimize and avoid |
| 134 | // resources used for displaying graphical output. |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 135 | bool never_composited; |
| 136 | |
Rakina Zata Amni | c7ffea88 | 2021-08-16 10:04:28 | [diff] [blame] | 137 | // Whether the window associated with this view was created by another window. |
| 138 | bool window_was_opened_by_another_window; |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 139 | |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 140 | // Indicates whether the view is a regular top-level widget or some other |
| 141 | // nested "main frame" widget type. |
| 142 | ViewWidgetType type; |
| 143 | |
Liam Brady | 5f699532 | 2022-04-04 18:56:24 | [diff] [blame] | 144 | // If the frame being created is a fenced frame, stores the mode the fenced |
| 145 | // frame is set to. For all other frame types (type != kFencedFrame), this |
| 146 | // value will always be set to kDefault. Frames embedded in fenced frames |
| 147 | // will also have this value set to kDefault. |
| 148 | // Used by fenced frames to determine various security restrictions such as |
| 149 | // the URL type and size constraints. |
| 150 | blink.mojom.FencedFrameMode fenced_frame_mode; |
| 151 | |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 152 | // Endpoint for any messages that are broadcast to all views in a WebContents. |
| 153 | pending_associated_receiver<blink.mojom.PageBroadcast> blink_page_broadcast; |
Bo Liu | b5e79d9 | 2021-06-12 01:40:41 | [diff] [blame] | 154 | |
| 155 | // Base background color of this view. Only used by a local main frame. |
| 156 | skia.mojom.SkColor? base_background_color; |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 157 | }; |
| 158 | |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 159 | // A union to distinguish between parameters specific to local main frame |
| 160 | // creation and remote main frame creation. |
| 161 | union CreateMainFrameUnion { |
| 162 | CreateLocalMainFrameParams local_params; |
| 163 | CreateRemoteMainFrameParams remote_params; |
| 164 | }; |
| 165 | |
| 166 | // Parameters used for browser-initiated local main frame creation. |
| 167 | struct CreateLocalMainFrameParams { |
Daniel Cheng | 4daa5122 | 2021-02-21 07:20:11 | [diff] [blame] | 168 | // The frame token. Used to map between LocalFrame and RenderFrameHostImpl. |
| 169 | blink.mojom.LocalFrameToken token; |
| 170 | |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 171 | // The ID of the main frame hosted in the view. Must not be kRoutingIdNone. |
| 172 | int32 routing_id = IPC.mojom.kRoutingIdNone; |
| 173 | |
| 174 | // The communication interfaces for the WebLocalFrame in blink. |
| 175 | pending_associated_receiver<content.mojom.Frame> frame; |
| 176 | |
| 177 | pending_remote<blink.mojom.BrowserInterfaceBroker> interface_broker; |
| 178 | |
Dominic Farolino | 12e06d7 | 2022-08-05 02:29:49 | [diff] [blame] | 179 | // The `AssociatedInterfaceProvider` that the main `RenderFrameImpl` will use |
| 180 | // to request associated interfaces from its corresponding |
| 181 | // `RenderFrameHostImpl`. |
| 182 | pending_associated_remote<blink.mojom.AssociatedInterfaceProvider> |
| 183 | associated_interface_provider_remote; |
| 184 | |
Rakina Zata Amni | 86c88fa | 2021-11-01 01:27:30 | [diff] [blame] | 185 | // Whether the frame is still on the initial empty document or not. |
| 186 | bool is_on_initial_empty_document = true; |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 187 | |
| 188 | // Null when the main frame has no policy container yet (for example, because |
| 189 | // it is a speculative RenderFrameHost), and the policy container will be |
| 190 | // sent during CommitNavigation. |
| 191 | blink.mojom.PolicyContainer? policy_container; |
| 192 | |
| 193 | CreateFrameWidgetParams widget_params; |
Lukasz Anforowicz | 7624ae2 | 2021-04-14 16:17:50 | [diff] [blame] | 194 | |
| 195 | // Subresource loader factories to be used by the initial empty document. |
| 196 | blink.mojom.URLLoaderFactoryBundle subresource_loader_factories; |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 197 | }; |
| 198 | |
| 199 | // Parameters used for brower-initiated remote main frame creation. |
| 200 | struct CreateRemoteMainFrameParams { |
Daniel Cheng | 4daa5122 | 2021-02-21 07:20:11 | [diff] [blame] | 201 | blink.mojom.RemoteFrameToken token; |
| 202 | |
Dave Tapuska | 82b5401 | 2022-07-15 23:26:10 | [diff] [blame] | 203 | // The communication channels for the Remote/RemoteMainFrame in this view. |
Dave Tapuska | 0fcfeb78 | 2022-07-27 19:44:40 | [diff] [blame] | 204 | blink.mojom.RemoteFrameInterfacesFromBrowser frame_interfaces; |
Dave Tapuska | 51dcc9e | 2022-08-03 14:09:48 | [diff] [blame] | 205 | blink.mojom.RemoteMainFrameInterfaces main_frame_interfaces; |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 206 | }; |
| 207 | |
| 208 | // Parameters used for creating a new frame widget. |
| 209 | struct CreateFrameWidgetParams { |
| 210 | // Gives the routing ID for the RenderWidget that will be attached to the |
| 211 | // new RenderFrame. |
| 212 | int32 routing_id; |
| 213 | |
| 214 | // The communication interfaces for the WebFrameWidget in blink. |
| 215 | pending_associated_remote<blink.mojom.FrameWidgetHost> frame_widget_host; |
| 216 | pending_associated_receiver<blink.mojom.FrameWidget> frame_widget; |
| 217 | pending_associated_remote<blink.mojom.WidgetHost> widget_host; |
| 218 | pending_associated_receiver<blink.mojom.Widget> widget; |
| 219 | |
| 220 | // The initial visual properties of the widget. |
| 221 | blink.mojom.VisualProperties visual_properties; |
| 222 | }; |
| 223 | |
| 224 | // Used for recreating child frames after a crash (does this still happen?) and |
| 225 | // speculative/provisional frames (including main frame). |
| 226 | // |
| 227 | // "Normal" child frame creation (via inserting a new frame owner element into |
| 228 | // the active document) does not use these params and is routed via |
| 229 | // CreateChildFrame(). |
| 230 | // |
| 231 | // "Normal" main frame creation (whether browser-initiated, e.g. opening a new |
| 232 | // tab, or renderer-initiated, e.g. window.open()) also do not use these params |
| 233 | // and are routed via CreateView() and CreateNewWindow() respectively. |
| 234 | // |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 235 | struct CreateFrameParams { |
Daniel Cheng | 4daa5122 | 2021-02-21 07:20:11 | [diff] [blame] | 236 | // The frame token. Used to map between LocalFrame and RenderFrameHostImpl. |
| 237 | blink.mojom.LocalFrameToken token; |
| 238 | |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 239 | // Specifies the routing ID of the new RenderFrame object. |
| 240 | int32 routing_id; |
| 241 | |
Dave Tapuska | fd3d5ed | 2022-06-28 17:03:07 | [diff] [blame] | 242 | // If a valid |previous_frame_token| is provided, the new frame will be |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 243 | // configured to replace either the previous frame or the previous proxy on |
| 244 | // commit. |
Dave Tapuska | fd3d5ed | 2022-06-28 17:03:07 | [diff] [blame] | 245 | blink.mojom.FrameToken? previous_frame_token; |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 246 | |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 247 | // Specifies the new frame's opener. The opener will be null if this is |
Anton Bikineev | f62d1bf | 2021-05-15 17:56:07 | [diff] [blame] | 248 | // absl::nullopt. |
Chris Hamilton | 2ea2031 | 2021-02-24 17:20:14 | [diff] [blame] | 249 | blink.mojom.FrameToken? opener_frame_token; |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 250 | |
Dave Tapuska | fd3d5ed | 2022-06-28 17:03:07 | [diff] [blame] | 251 | // The new frame should be created as a child of the object identified by |
| 252 | // `parent_frame_token`. If this is not specified it will be a a top level |
| 253 | // frame. |
| 254 | blink.mojom.FrameToken? parent_frame_token; |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 255 | |
| 256 | // Identifies the previous sibling of the new frame, so that the new frame is |
| 257 | // inserted into the correct place in the frame tree. If this is |
Dave Tapuska | fd3d5ed | 2022-06-28 17:03:07 | [diff] [blame] | 258 | // not specified the frame will be created as the leftmost child of its |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 259 | // parent frame, in front of any other children. |
Dave Tapuska | fd3d5ed | 2022-06-28 17:03:07 | [diff] [blame] | 260 | blink.mojom.FrameToken? previous_sibling_frame_token; |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 261 | |
| 262 | pending_remote<blink.mojom.BrowserInterfaceBroker> interface_broker; |
| 263 | |
Daniel Cheng | 6ac12817 | 2021-05-25 18:49:01 | [diff] [blame] | 264 | blink.mojom.TreeScopeType tree_scope_type; |
| 265 | |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 266 | // When the new frame has a parent, |replication_state| holds the new frame's |
| 267 | // properties replicated from the process rendering the parent frame, such as |
| 268 | // the new frame's sandbox flags. |
Gyuyoung Kim | c16e52e9 | 2021-03-19 02:45:37 | [diff] [blame] | 269 | blink.mojom.FrameReplicationState replication_state; |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 270 | |
| 271 | // Used for devtools instrumentation and trace-ability. The token is |
| 272 | // propagated to Blink's LocalFrame and both Blink and content/ |
| 273 | // can tag calls and requests with this instrumentation token in order to |
| 274 | // attribute them to the context frame. |
| 275 | // |devtools_frame_token| is only defined by the browser and is never |
| 276 | // sent back from the renderer in the control calls. |
| 277 | mojo_base.mojom.UnguessableToken devtools_frame_token; |
| 278 | |
| 279 | // When the new frame has a parent, |frame_owner_properties| holds the |
| 280 | // properties of the HTMLFrameOwnerElement from the parent process. |
| 281 | // Note that unlike FrameReplicationState, this is not replicated for remote |
| 282 | // frames. |
| 283 | blink.mojom.FrameOwnerProperties frame_owner_properties; |
| 284 | |
| 285 | // Specifies properties for a new RenderWidget that will be attached to the |
| 286 | // new RenderFrame (if one is needed). |
| 287 | CreateFrameWidgetParams? widget_params; |
| 288 | |
Rakina Zata Amni | 86c88fa | 2021-11-01 01:27:30 | [diff] [blame] | 289 | // Whether the frame is still on the initial empty document or not. |
| 290 | bool is_on_initial_empty_document = true; |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 291 | |
| 292 | // The policy container for the frame to be created. This can be null if we |
| 293 | // could not determine a policy container yet, for example in case of a |
| 294 | // speculative RenderFrameHost. In that case, the final policy container will |
| 295 | // be sent along CommitNavigation. |
| 296 | blink.mojom.PolicyContainer? policy_container; |
| 297 | |
| 298 | // The mojo connection to the mojom::Frame in the renderer. |
| 299 | pending_associated_receiver<content.mojom.Frame> frame; |
Dominic Farolino | 12e06d7 | 2022-08-05 02:29:49 | [diff] [blame] | 300 | |
| 301 | // The `AssociatedInterfaceProvider` that the `RenderFrameImpl` will use to |
| 302 | // request associated interfaces from its corresponding `RenderFrameHostImpl`. |
| 303 | pending_associated_remote<blink.mojom.AssociatedInterfaceProvider> |
| 304 | associated_interface_provider_remote; |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 305 | }; |
| 306 | |
Mario Sanchez Prada | 13bbad5 | 2020-06-01 18:12:29 | [diff] [blame] | 307 | // Provided with each call to Frame::GetSerializedHtmlWithLocalLinks() so that |
| 308 | // the renderer can notify the browser process each time that a chunk of HTML |
| 309 | // data gets serialized, as well as when the entire process is finished. |
| 310 | interface FrameHTMLSerializerHandler { |
| 311 | // Sent by the renderer as a response to GetSerializedHtmlWithLocalLinks() to |
| 312 | // indicate that HTML data has been serialized, included in |data_buffer|. |
| 313 | DidReceiveData(string data_buffer); |
| 314 | |
| 315 | // Reports that the serialization process is finished. It is expected to |
| 316 | // receive this message right after the last time DidReceiveData() is called. |
| 317 | Done(); |
| 318 | }; |
| 319 | |
Dominic Mazzoni | 77d0aba | 2021-01-14 09:42:16 | [diff] [blame] | 320 | struct SnapshotAccessibilityTreeParams { |
| 321 | // See ui/accessibility/ax_mode.h for valid values of |ax_mode|. |
| 322 | uint32 ax_mode; |
| 323 | |
| 324 | // If true, nodes that are entirely offscreen will have their entire |
| 325 | // subtree excluded. Note that this heuristic is imperfect, and |
| 326 | // an absolute-positioned node that's visible, but whose ancestors |
| 327 | // are entirely offscreen, may get excluded. |
| 328 | bool exclude_offscreen; |
| 329 | |
| 330 | // The maximum number of nodes to snapshot before exiting early. |
| 331 | // Note that this is not a hard limit; once this limit is reached a |
| 332 | // few more nodes may be added in order to ensure a well-formed |
| 333 | // tree is returned. Use 0 for no max. The corresponding C++ code |
| 334 | // uses size_t. |
| 335 | uint64 max_nodes; |
| 336 | |
| 337 | // The maximum amount of time to spend snapshotting the tree. Like |
| 338 | // max_nodes, this is not a hard limit, and once this limit is reached |
| 339 | // a few more nodes may be added in order to ensure a well-formed tree. |
| 340 | // Use 0 for no timeout. |
| 341 | mojo_base.mojom.TimeDelta timeout; |
| 342 | }; |
| 343 | |
Dave Tapuska | 795de45a | 2021-01-12 20:48:05 | [diff] [blame] | 344 | // An enumeration specifying the reason of the frame deletion. |
| 345 | enum FrameDeleteIntention { |
| 346 | // The frame being deleted isn't a (speculative) main frame. |
| 347 | kNotMainFrame, |
| 348 | // The frame being deleted is a speculative main frame, and it is being |
| 349 | // deleted as part of the shutdown for that WebContents. The entire RenderView |
| 350 | // etc will be destroyed by a separate IPC sent later. |
| 351 | kSpeculativeMainFrameForShutdown, |
| 352 | // The frame being deleted is a speculative main frame, and it is being |
| 353 | // deleted because the speculative navigation was cancelled. This is not part |
| 354 | // of shutdown. |
| 355 | kSpeculativeMainFrameForNavigationCancelled, |
| 356 | }; |
| 357 | |
danakj | 0bdfacd | 2021-01-20 19:27:18 | [diff] [blame] | 358 | // Implemented by the frame provider, and must be associated with other content |
| 359 | // mojoms bound to frames, widgets, views, and currently also with the legacy |
| 360 | // IPC channel. |
Arthur Hemery | d3011f6 | 2018-05-30 10:38:44 | [diff] [blame] | 361 | // KEEP THE COMMIT FUNCTIONS IN SYNC in content/common/navigation_client.mojom. |
danakj | 0bdfacd | 2021-01-20 19:27:18 | [diff] [blame] | 362 | // These will eventually be removed from Frame. |
| 363 | interface Frame { |
clamy | af4bf2d9 | 2018-02-06 10:54:36 | [diff] [blame] | 364 | // Tells the renderer that a same-document navigation should be committed. |
| 365 | // The renderer will return a status value indicating whether the commit |
| 366 | // could proceed as expected or not. In particular, it might be necessary to |
| 367 | // restart the navigation if it is no-longer same-document, which can happen |
| 368 | // if the renderer committed another navigation in the meantime. |
| 369 | CommitSameDocumentNavigation( |
Minggang Wang | b9f3fa9 | 2021-07-01 15:30:31 | [diff] [blame] | 370 | blink.mojom.CommonNavigationParams common_params, |
| 371 | blink.mojom.CommitNavigationParams request_params) |
clamy | af4bf2d9 | 2018-02-06 10:54:36 | [diff] [blame] | 372 | => (blink.mojom.CommitResult commit_result); |
| 373 | |
Chong Zhang | 7306b0b | 2018-01-24 05:59:24 | [diff] [blame] | 374 | // Provides the renderer an updated |subresource_loader_factories|. |
| 375 | // |
| 376 | // This method is intended to fix broken loaders after a Network Service |
| 377 | // crash, and is only used when Network Service is enabled. |
| 378 | // |
| 379 | // The new bundle contains replacement factories for a subset of the |
| 380 | // receiver's existing bundle. |
| 381 | UpdateSubresourceLoaderFactories( |
Hiroki Nakagawa | 75375834 | 2018-12-27 04:13:49 | [diff] [blame] | 382 | blink.mojom.URLLoaderFactoryBundle subresource_loader_factories); |
Dmitry Gozman | 6adf95b | 2018-10-10 22:12:19 | [diff] [blame] | 383 | |
Ian Barkley-Yeung | bda77fb | 2020-12-08 04:26:46 | [diff] [blame] | 384 | // Indicates that the frame host (browser) wants the |untrusted_stack_trace| |
| 385 | // parameter of DidAddMessageToConsole() filled in for Error messages if at |
| 386 | // all possible. |
| 387 | SetWantErrorMessageStackTrace(); |
| 388 | |
Dave Tapuska | ca25070 | 2021-01-07 17:40:55 | [diff] [blame] | 389 | // Unload this RenderFrame and replace it by a RenderFrameProxy, so the frame |
| 390 | // can navigate to a document rendered by a different process. The unload can |
| 391 | // fail if the RenderFrame is currently detached (it was removed from the |
| 392 | // frame tree before the Unload was received). If successful this message will |
| 393 | // send back AgentSchedulingGroupHost::DidUnloadRenderFrame message. This |
| 394 | // cannot be a standard reply callback because the unload acknowledgement must |
| 395 | // be posted back to the event loop to be invoked later. This is to ensure |
| 396 | // that any postMessage() calls executed by JS during unload are dispatched, |
| 397 | // since postMessage dispatch is always scheduled asynchronously. |
Daniel Cheng | c3d1e8d | 2021-06-23 02:11:45 | [diff] [blame] | 398 | // |
Dave Tapuska | 82b5401 | 2022-07-15 23:26:10 | [diff] [blame] | 399 | // `new_remote_frame_replication_state`, `new_remote_frame_token`, |
| 400 | // and `new_remote_main_frame_interfaces` are used to construct the new |
| 401 | // RenderFrameProxy. `is_loading` mirrors the loading state of the |
| 402 | // FrameTreeNode's current RenderFrameHost and determines whether |
Daniel Cheng | c3d1e8d | 2021-06-23 02:11:45 | [diff] [blame] | 403 | // the newly-constructed RenderFrameProxy is marked as loading or not. |
Yeunjoo Choi | 355f769d | 2021-05-20 05:32:28 | [diff] [blame] | 404 | Unload( |
Yeunjoo Choi | 355f769d | 2021-05-20 05:32:28 | [diff] [blame] | 405 | bool is_loading, |
| 406 | blink.mojom.FrameReplicationState new_remote_frame_replication_state, |
| 407 | blink.mojom.RemoteFrameToken new_remote_frame_token, |
Dave Tapuska | 0fcfeb78 | 2022-07-27 19:44:40 | [diff] [blame] | 408 | blink.mojom.RemoteFrameInterfacesFromBrowser new_remote_frame_interfaces, |
Dave Tapuska | 51dcc9e | 2022-08-03 14:09:48 | [diff] [blame] | 409 | blink.mojom.RemoteMainFrameInterfaces new_remote_main_frame_interfaces); |
Dave Tapuska | 795de45a | 2021-01-12 20:48:05 | [diff] [blame] | 410 | |
| 411 | // Delete the frame. This is only called for child frames that the browser |
| 412 | // wants to detach, or for speculative main frames which are owned by the |
| 413 | // browser process. Committed main frames are owned by the renderer's WebView |
| 414 | // and can not be deleted directly. |
| 415 | Delete(FrameDeleteIntention intention); |
danakj | 0bdfacd | 2021-01-20 19:27:18 | [diff] [blame] | 416 | |
Daniel Cheng | c3d1e8d | 2021-06-23 02:11:45 | [diff] [blame] | 417 | // Requests that a speculative RenderFrameHost which the browser has already |
| 418 | // sent a `CommitNavigation()` to should swap itself back out for a |
| 419 | // RenderFrameProxy to effectively undo the `CommitNavigation()`. |
| 420 | // |
| 421 | // This is needed when discarding a speculative RenderFrameHost that's already |
| 422 | // been asked to commit a navigation, as the state between the browser and |
| 423 | // renderer would otherwise be out of sync: |
| 424 | // |
| 425 | // - from the perspective of the browser process, the speculative |
| 426 | // RenderFrameHost has not yet committed as it has not yet acknowledged the |
| 427 | // `CommitNavigation()` with `DidCommitNavigation()`. |
| 428 | // - but any IPCs sent from the browser to the renderer will see that the |
| 429 | // provisional RenderFrame has already been swapped in and the |
| 430 | // RenderFrameProxy it replaced destroyed. |
| 431 | // |
| 432 | // Note: This, of course, does not work for RenderDocument, since the |
| 433 | // provisional RenderFrame replaces *another* RenderFrame when it commits. The |
| 434 | // state associated with the replaced RenderFrame is already gone, and it's |
| 435 | // impossible to restore it. Fixing this issue for RenderDocument will |
| 436 | // require serious reworking of how navigations are committed. |
| 437 | // |
| 438 | // While this is very similar to `Unload()`, the renderer will not send any |
| 439 | // unload ACK back to the browser on completion. As a result, there is no |
| 440 | // special handling to ensure messages queued by Window.postMessage() are |
| 441 | // forwarded. |
| 442 | // |
Dave Tapuska | 82b5401 | 2022-07-15 23:26:10 | [diff] [blame] | 443 | // `new_remote_frame_replication_state`, `new_remote_frame_token`, and |
| 444 | // `new_remote_main_frame_interfaces` are used to construct the new |
| 445 | // RenderFrameProxy. `is_loading` mirrors the loading state of the |
| 446 | // FrameTreeNode's current RenderFrameHost and determines whether |
Daniel Cheng | c3d1e8d | 2021-06-23 02:11:45 | [diff] [blame] | 447 | // the newly-constructed RenderFrameProxy is marked as loading or not. |
| 448 | // |
| 449 | // TODO(dcheng): It's unclear if `is_loading` is necessary; presently, it |
| 450 | // always seems to be true when this IPC is called. |
| 451 | UndoCommitNavigation( |
Daniel Cheng | c3d1e8d | 2021-06-23 02:11:45 | [diff] [blame] | 452 | bool is_loading, |
| 453 | blink.mojom.FrameReplicationState new_remote_frame_replication_state, |
| 454 | blink.mojom.RemoteFrameToken new_remote_frame_token, |
Dave Tapuska | 0fcfeb78 | 2022-07-27 19:44:40 | [diff] [blame] | 455 | blink.mojom.RemoteFrameInterfacesFromBrowser new_remote_frame_interfaces, |
Dave Tapuska | 51dcc9e | 2022-08-03 14:09:48 | [diff] [blame] | 456 | blink.mojom.RemoteMainFrameInterfaces new_remote_main_frame_interfaces); |
Daniel Cheng | c3d1e8d | 2021-06-23 02:11:45 | [diff] [blame] | 457 | |
danakj | 0bdfacd | 2021-01-20 19:27:18 | [diff] [blame] | 458 | // Causes all new subresource requests to be blocked (not being started) until |
| 459 | // ResumeBlockedRequests is called. |
| 460 | BlockRequests(); |
| 461 | |
| 462 | // Resumes blocked requests. |
| 463 | // It is safe to call this without calling BlockRequests. |
| 464 | ResumeBlockedRequests(); |
| 465 | |
| 466 | GetInterfaceProvider( |
| 467 | pending_receiver<service_manager.mojom.InterfaceProvider> interfaces); |
| 468 | |
danakj | 0bdfacd | 2021-01-20 19:27:18 | [diff] [blame] | 469 | // Requests a one-time snapshot of the accessibility tree without enabling |
| 470 | // accessibility if it wasn't already enabled. |
| 471 | SnapshotAccessibilityTree(SnapshotAccessibilityTreeParams params) |
| 472 | => (ax.mojom.AXTreeUpdate snapshot); |
| 473 | |
Abigail Klein | a303f27 | 2022-03-31 22:32:57 | [diff] [blame] | 474 | // Requests a one-time distillation of the accessibility tree without enabling |
| 475 | // accessibility if it wasn't already enabled. |
| 476 | SnapshotAndDistillAXTree() => (ax.mojom.AXTreeUpdate snapshot, |
Abigail Klein | 277fe7c2 | 2022-04-11 21:38:45 | [diff] [blame] | 477 | array<int32> content_node_ids); |
Abigail Klein | a303f27 | 2022-03-31 22:32:57 | [diff] [blame] | 478 | |
danakj | 0bdfacd | 2021-01-20 19:27:18 | [diff] [blame] | 479 | // Get HTML data by serializing the target frame and replacing all resource |
| 480 | // links with a path to the local copy passed in the message payload. In order |
| 481 | // to report progress to the the browser process, a pending remote is passed |
| 482 | // via |callback_remote|, so that direct communication with the SavePackage |
| 483 | // object that initiated the process can be established. |
| 484 | GetSerializedHtmlWithLocalLinks( |
| 485 | map<url.mojom.Url, mojo_base.mojom.FilePath> url_map, |
Chris Hamilton | 2ea2031 | 2021-02-24 17:20:14 | [diff] [blame] | 486 | map<blink.mojom.FrameToken, mojo_base.mojom.FilePath> |
danakj | 0bdfacd | 2021-01-20 19:27:18 | [diff] [blame] | 487 | frame_token_map, bool save_with_empty_url, |
| 488 | pending_remote<FrameHTMLSerializerHandler> handler_remote); |
Ken Rockot | 4878545 | 2017-10-25 19:33:14 | [diff] [blame] | 489 | }; |
| 490 | |
sammc | 7f6c6a0 | 2017-01-30 00:53:51 | [diff] [blame] | 491 | // Implemented by the frame (e.g. renderer processes). |
| 492 | // Instances of this interface must be associated with (i.e., FIFO with) the |
| 493 | // legacy IPC channel. |
| 494 | interface FrameBindingsControl { |
| 495 | // Used to tell a render frame whether it should expose various bindings |
| 496 | // that allow JS content extended privileges. See BindingsPolicy for valid |
| 497 | // flag values. |
| 498 | AllowBindings(int32 enabled_bindings_flags); |
Nasko Oskov | 8a73f7d | 2019-09-27 22:29:32 | [diff] [blame] | 499 | |
| 500 | // Used to tell the RenderFrame to enable Mojo JS bindings, which allows |
| 501 | // JS code running in the renderer process to connect to Mojo interfaces |
| 502 | // and make method calls on them. |
Jiewei Qian | cc639a66 | 2022-04-01 02:43:34 | [diff] [blame] | 503 | // |
| 504 | // ExtraMojoJsFeatures describes a set of additional features that can be |
| 505 | // used with MojoJs. For example, helper methods for MojoJs to better work |
| 506 | // with Web API objects. |
| 507 | // |
Nasko Oskov | 8a73f7d | 2019-09-27 22:29:32 | [diff] [blame] | 508 | // This is used for WebUI only at this time. |
Jiewei Qian | cc639a66 | 2022-04-01 02:43:34 | [diff] [blame] | 509 | EnableMojoJsBindings(ExtraMojoJsFeatures? features); |
Miyoung Shin | 072d405 | 2020-07-13 07:52:44 | [diff] [blame] | 510 | |
Jiewei Qian | cf6b35a | 2021-08-25 04:43:46 | [diff] [blame] | 511 | // Used to enable MojoJS bindings, exposing only the interfaces provided |
| 512 | // by `broker`. |
| 513 | EnableMojoJsBindingsWithBroker( |
| 514 | pending_remote<blink.mojom.BrowserInterfaceBroker> broker); |
| 515 | |
Miyoung Shin | 072d405 | 2020-07-13 07:52:44 | [diff] [blame] | 516 | // Used to bind WebUI and WebUIHost mojo connections. |
Daniel Cheng | 4b931a4f | 2020-12-18 01:59:35 | [diff] [blame] | 517 | BindWebUI(pending_associated_receiver<content.mojom.WebUI> receiver, |
| 518 | pending_associated_remote<content.mojom.WebUIHost> remote); |
sammc | 7f6c6a0 | 2017-01-30 00:53:51 | [diff] [blame] | 519 | }; |
| 520 | |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame] | 521 | struct CreateNewWindowParams { |
Mustaq Ahmed | 8601a56 | 2020-01-31 18:05:52 | [diff] [blame] | 522 | // True if ContentRendererClient allows popups. This is the case only for |
| 523 | // extensions. |
| 524 | bool allow_popup; |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame] | 525 | |
| 526 | // Type of window requested. |
| 527 | WindowContainerType window_container_type; |
| 528 | |
| 529 | // The session storage namespace ID this window should use. |
Daniel Murphy | 31bbb8b1 | 2018-02-07 21:44:10 | [diff] [blame] | 530 | string session_storage_namespace_id; |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame] | 531 | |
Daniel Murphy | e3eec92c | 2018-02-23 19:09:15 | [diff] [blame] | 532 | // The session storage namespace ID this window should clone from. |
| 533 | // TODO(dmurph): Remove this once session storage is fully mojo'd, as the |
| 534 | // clone call happens on a different interface. https://crbug.com/716490 |
| 535 | string clone_from_session_storage_namespace_id; |
| 536 | |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame] | 537 | // The name of the resulting frame that should be created (empty if none |
| 538 | // has been specified). UTF8 encoded string. |
| 539 | string frame_name; |
| 540 | |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame] | 541 | // Whether the opener will be suppressed in the new window, in which case |
| 542 | // scripting the new window is not allowed. |
| 543 | bool opener_suppressed; |
| 544 | |
jongdeok.kim | 5de823b3 | 2022-06-14 04:37:50 | [diff] [blame] | 545 | // Whether new window is created for a form submission. |
| 546 | bool is_form_submission; |
| 547 | |
| 548 | // Body of HTTP POST request for form submission. |
| 549 | network.mojom.URLRequestBody? form_submission_post_data; |
| 550 | |
| 551 | // The content type from the request headers for POST requests. |
| 552 | string form_submission_post_content_type; |
| 553 | |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame] | 554 | // Whether the window should be opened in the foreground, background, etc. |
| 555 | ui.mojom.WindowOpenDisposition disposition; |
| 556 | |
| 557 | // The URL that will be loaded in the new window (empty if none has been |
| 558 | // specified). |
| 559 | url.mojom.Url target_url; |
| 560 | |
| 561 | // The referrer that will be used to load |target_url| (empty if none has |
| 562 | // been specified). |
| 563 | blink.mojom.Referrer referrer; |
| 564 | |
| 565 | // The window features to use for the new window. |
| 566 | blink.mojom.WindowFeatures features; |
John Delaney | 8623c64 | 2021-01-06 17:37:07 | [diff] [blame] | 567 | |
| 568 | // The impression associated with the navigation in the new window, if |
| 569 | // one is specified. |
Minggang Wang | b9f3fa9 | 2021-07-01 15:30:31 | [diff] [blame] | 570 | blink.mojom.Impression? impression; |
Antonio Sartori | 6984c74 | 2021-08-26 08:03:41 | [diff] [blame] | 571 | |
| 572 | // Governs how downloads are handled if `target_url` results in a download. |
| 573 | blink.mojom.NavigationDownloadPolicy download_policy; |
Tommy Steimel | 991916c4 | 2022-06-24 20:59:57 | [diff] [blame] | 574 | |
| 575 | // Additional parameters for creating picture-in-picture windows. |
| 576 | blink.mojom.PictureInPictureWindowOptions? pip_options; |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame] | 577 | }; |
| 578 | |
Daniel Cheng | 8bb30c6 | 2017-10-23 20:40:47 | [diff] [blame] | 579 | // Operation result when the renderer asks the browser to create a new window. |
| 580 | enum CreateNewWindowStatus { |
Garrett Tanzer | 6b66a45 | 2022-03-02 18:33:42 | [diff] [blame] | 581 | // Creation of the new window was blocked, e.g. because the source frame |
| 582 | // doesn't have user activation. |
| 583 | kBlocked, |
| 584 | // Ignore creation of the new window, e.g. because noopener is in effect. |
Daniel Cheng | 8bb30c6 | 2017-10-23 20:40:47 | [diff] [blame] | 585 | kIgnore, |
| 586 | // Reuse the current window rather than creating a new window. |
| 587 | kReuse, |
| 588 | // Create a new window using the corresponding params in |reply|. |
| 589 | kSuccess, |
| 590 | }; |
| 591 | |
| 592 | // All routing IDs in this struct must be set to a valid routing ID. |
Daniel Cheng | 4daa5122 | 2021-02-21 07:20:11 | [diff] [blame] | 593 | // TODO(dcheng): It's almost possible to use CreateLocalMainFrameParams here. |
| 594 | // See if there's a reasonable way to factor out state here by splitting things |
| 595 | // into browser-created params vs renderer-created params. |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame] | 596 | struct CreateNewWindowReply { |
Daniel Cheng | 4daa5122 | 2021-02-21 07:20:11 | [diff] [blame] | 597 | // The unique identifier of the RenderFrameHost |
| 598 | blink.mojom.LocalFrameToken main_frame_token; |
| 599 | |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame] | 600 | // The ID of the main frame hosted in the view. |
| 601 | int32 main_frame_route_id; |
| 602 | |
danakj | 0bdfacd | 2021-01-20 19:27:18 | [diff] [blame] | 603 | // The pending mojo connection to the Frame implementation in the renderer. |
| 604 | pending_associated_receiver<content.mojom.Frame> frame; |
| 605 | |
Daniel Cheng | d1b77555 | 2021-02-19 18:50:02 | [diff] [blame] | 606 | CreateFrameWidgetParams widget_params; |
Dave Tapuska | 8499eec | 2020-03-16 17:54:30 | [diff] [blame] | 607 | |
Yuzu Saijo | d46f498a | 2020-08-04 02:56:22 | [diff] [blame] | 608 | // The communication interfaces for the PageBroadcast. |
| 609 | pending_associated_receiver<blink.mojom.PageBroadcast> page_broadcast; |
| 610 | |
Ken Rockot | c4a0ada9 | 2020-12-02 00:22:14 | [diff] [blame] | 611 | pending_remote<blink.mojom.BrowserInterfaceBroker> |
| 612 | main_frame_interface_broker; |
Balazs Engedy | ba034e7 | 2017-10-27 22:26:28 | [diff] [blame] | 613 | |
Dominic Farolino | 12e06d7 | 2022-08-05 02:29:49 | [diff] [blame] | 614 | // The `AssociatedInterfaceProvider` that the main `RenderFrameImpl` will use |
| 615 | // to request associated interfaces from its corresponding |
| 616 | // `RenderFrameHostImpl`. |
| 617 | pending_associated_remote<blink.mojom.AssociatedInterfaceProvider> |
| 618 | associated_interface_provider; |
| 619 | |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame] | 620 | // Duplicated from CreateNewWindowParams because legacy code. |
Daniel Murphy | 31bbb8b1 | 2018-02-07 21:44:10 | [diff] [blame] | 621 | string cloned_session_storage_namespace_id; |
Pavel Feldman | 08beed784 | 2017-10-17 19:18:11 | [diff] [blame] | 622 | |
Daniel Cheng | 4daa5122 | 2021-02-21 07:20:11 | [diff] [blame] | 623 | // Used for devtools instrumentation and trace-ability. The token is shared |
| 624 | // across all frames (local or remotes) representing the same logical frame |
| 625 | // tree node, and is used by Blink and content to tag calls and requests for |
| 626 | // instrumentation purposes, allowing them to be attributed to a context |
| 627 | // frame. |
| 628 | // |
| 629 | // Must not be used to look up a RenderFrameHostImpl or RenderFrameProxyHost |
| 630 | // in the browser process, as the token is shared, making the mapping |
| 631 | // ambiguous and non-authoritative. |
Oksana Zhuravlova | 34579e91 | 2018-03-23 00:18:49 | [diff] [blame] | 632 | mojo_base.mojom.UnguessableToken devtools_main_frame_token; |
Yury Semikhatsky | 82730ff | 2020-02-25 22:29:26 | [diff] [blame] | 633 | |
| 634 | // Used by devtools instrumentation to tell devtools agent in the renderer |
| 635 | // that it should pause created window and wait for an explicit resume command |
| 636 | // from the client. |
| 637 | bool wait_for_debugger; |
Antonio Sartori | 7f809cc7 | 2020-10-30 07:47:20 | [diff] [blame] | 638 | |
| 639 | // The policy container for the new frame that will be created by Blink in |
| 640 | // response. |
Antonio Sartori | 9290b6b | 2020-11-09 10:09:33 | [diff] [blame] | 641 | blink.mojom.PolicyContainer policy_container; |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame] | 642 | }; |
| 643 | |
Rakina Zata Amni | af55b5b6 | 2022-07-19 23:11:03 | [diff] [blame] | 644 | // A per-navigation interface passed along with the BeginNavigation call, used |
| 645 | // to listen to the end of the renderer-initiated navigation cancelation window |
| 646 | // for that navigation. See comment below for more details. |
| 647 | interface NavigationRendererCancellationListener { |
| 648 | // Called when the navigation cancellation window for a renderer-initiated |
| 649 | // navigation ended, as the JS task in which the navigation started had |
| 650 | // finished running. Renderer-initiated navigations need to wait for this |
| 651 | // message before they can commit, as those navigations can be canceled by |
| 652 | // script (e.g. through calling window.stop() or document.open()) that runs |
| 653 | // on the same task. See RendererCancellationThrottle for more details. |
| 654 | RendererCancellationWindowEnded(); |
| 655 | }; |
| 656 | |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame] | 657 | // Implemented by the frame server (i.e. the browser process). For messages that |
| 658 | // must be associated with the IPC channel. |
| 659 | interface FrameHost { |
Daniel Cheng | 8bb30c6 | 2017-10-23 20:40:47 | [diff] [blame] | 660 | // Sent by the renderer to request the browser to create a new window. |reply| |
| 661 | // is only non-null on when status == CreateNewWindowStatus::kSuccess. |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame] | 662 | [Sync] CreateNewWindow(CreateNewWindowParams params) |
Daniel Cheng | 8bb30c6 | 2017-10-23 20:40:47 | [diff] [blame] | 663 | => (CreateNewWindowStatus status, CreateNewWindowReply? reply); |
Yutaka Hirano | f7f2f63 | 2017-09-06 10:40:08 | [diff] [blame] | 664 | |
Dave Tapuska | 4e60c23 | 2020-11-05 15:49:32 | [diff] [blame] | 665 | // Asynchronously creates a child frame. A routing ID must be allocated first |
| 666 | // by calling RenderMessageFilter::GenerateFrameRoutingID() |
| 667 | // Each of these messages will have a corresponding mojom::FrameHost::Detach |
| 668 | // API sent when the frame is detached from the DOM. |
| 669 | CreateChildFrame(int32 child_routing_id, |
danakj | 0bdfacd | 2021-01-20 19:27:18 | [diff] [blame] | 670 | pending_associated_remote<content.mojom.Frame> frame, |
Dave Tapuska | 4e60c23 | 2020-11-05 15:49:32 | [diff] [blame] | 671 | pending_receiver<blink.mojom.BrowserInterfaceBroker> |
| 672 | browser_interface_broker, |
Antonio Sartori | db967c5 | 2021-01-20 09:54:30 | [diff] [blame] | 673 | blink.mojom.PolicyContainerBindParams |
| 674 | policy_container_bind_params, |
Dominic Farolino | 12e06d7 | 2022-08-05 02:29:49 | [diff] [blame] | 675 | pending_associated_receiver<blink.mojom.AssociatedInterfaceProvider> |
| 676 | associated_interface_provider, |
Dave Tapuska | 4e60c23 | 2020-11-05 15:49:32 | [diff] [blame] | 677 | blink.mojom.TreeScopeType scope, |
| 678 | string frame_name, |
| 679 | string frame_unique_name, |
| 680 | bool is_created_by_script, |
| 681 | blink.mojom.FramePolicy frame_policy, |
| 682 | blink.mojom.FrameOwnerProperties frame_owner_properties, |
Kevin McNee | 43fe829 | 2021-10-04 22:59:41 | [diff] [blame] | 683 | ChildFrameOwnerElementType child_frame_owner_element_type); |
Dave Tapuska | 4e60c23 | 2020-11-05 15:49:32 | [diff] [blame] | 684 | |
Balazs Engedy | a40712f | 2017-09-15 15:01:11 | [diff] [blame] | 685 | // Sent by the renderer when a navigation commits in the frame. |
Oksana Zhuravlova | 8b88e57 | 2019-01-07 21:54:00 | [diff] [blame] | 686 | |
| 687 | // If |interface_params| is non-empty, the FrameHost implementation |
Ken Rockot | 228182e | 2020-12-01 18:43:59 | [diff] [blame] | 688 | // must unbind the old BrowserInterfaceBroker connections, and drop any |
| 689 | // interface requests pending on them. Then it should bind the appropriate |
| 690 | // requests and start servicing GetInterface messages coming in on these new |
| 691 | // connections in a security context that is appropriate for the committed |
| 692 | // navigation. |
Balazs Engedy | 0c8d550b | 2017-12-06 21:30:23 | [diff] [blame] | 693 | // |
Oksana Zhuravlova | 8b88e57 | 2019-01-07 21:54:00 | [diff] [blame] | 694 | // The FrameHost implementation must enforce that |interface_params| |
Balazs Engedy | 0c8d550b | 2017-12-06 21:30:23 | [diff] [blame] | 695 | // is set for cross-document navigations. This prevents origin confusion by |
| 696 | // ensuring that interface requests racing with navigation commit will be |
| 697 | // either ignored, or serviced correctly in the security context of the |
Ken Rockot | 228182e | 2020-12-01 18:43:59 | [diff] [blame] | 698 | // document they originated from (based on which BrowserInterfaceBroker |
| 699 | // connection the GetInterface messages arrive on). |
Balazs Engedy | a40712f | 2017-09-15 15:01:11 | [diff] [blame] | 700 | DidCommitProvisionalLoad( |
Balazs Engedy | 0c8d550b | 2017-12-06 21:30:23 | [diff] [blame] | 701 | DidCommitProvisionalLoadParams params, |
Oksana Zhuravlova | 8b88e57 | 2019-01-07 21:54:00 | [diff] [blame] | 702 | DidCommitProvisionalLoadInterfaceParams? interface_params); |
Arthur Hemery | 7b67a97 | 2017-12-01 15:24:49 | [diff] [blame] | 703 | |
Arthur Hemery | 7b0ae49 | 2018-02-05 16:04:45 | [diff] [blame] | 704 | // Sent by the renderer to indicate that a same document navigation |
| 705 | // committed in the renderer process. |
| 706 | DidCommitSameDocumentNavigation( |
Rakina Zata Amni | 2635778 | 2020-12-03 11:45:01 | [diff] [blame] | 707 | DidCommitProvisionalLoadParams params, |
| 708 | DidCommitSameDocumentNavigationParams same_document_params); |
Arthur Hemery | 7b0ae49 | 2018-02-05 16:04:45 | [diff] [blame] | 709 | |
Rakina Zata Amni | d09b611 | 2021-06-05 06:20:14 | [diff] [blame] | 710 | // Sent by the renderer to indicate that the document input stream has |
| 711 | // been updated using document.open() and that the URL for the current |
| 712 | // document in the frame should be updated to `url` per step 12 of |
| 713 | // https://whatwg.org/C/dynamic-markup-insertion.html#document-open-steps. |
| 714 | DidOpenDocumentInputStream(url.mojom.Url url); |
| 715 | |
Arthur Hemery | 7b67a97 | 2017-12-01 15:24:49 | [diff] [blame] | 716 | // Sent by the renderer to request a navigation. |
Marijn Kruisselbrink | 07bf59d5 | 2018-04-03 21:50:25 | [diff] [blame] | 717 | // |blob_url_token| should be non-null when this is a navigation to a blob: |
| 718 | // URL. The token will then be used to look up the blob associated with the |
| 719 | // blob URL. Without this by the time the navigation code starts fetching |
| 720 | // the URL the blob URL might no longer be valid. |blob_url_token| is |
| 721 | // not part of BeginNavigationParams because that struct needs to be |
| 722 | // cloneable, and thus can't contain mojo interfaces. |
| 723 | // If an invalid BlobURLToken is passed in, or if the token doesn't match the |
| 724 | // url in |common_params|, the navigation will result in a network error. |
Arthur Hemery | d3011f6 | 2018-05-30 10:38:44 | [diff] [blame] | 725 | // |navigation_client| is passed to the renderer to allow for further control |
Nasko Oskov | d22f9bf87 | 2020-12-23 00:31:35 | [diff] [blame] | 726 | // of the navigation. Allows for Commit and Cancels/Aborts. |
Antonio Sartori | db967c5 | 2021-01-20 09:54:30 | [diff] [blame] | 727 | // Passing the |initiator_policy_container_keep_alive_handle| is just a means |
| 728 | // to ensure that the PolicyContainerHost of the initiator RenderFrameHost is |
| 729 | // kept alive, even if the RenderFrameHost itself has already been deleted in |
| 730 | // the meantime. If this can be ensured in other ways, it is safe to pass a |
| 731 | // mojo::NullRemote. In particular, if the initiator LocalFrame is alive when |
| 732 | // issuing this mojo call, there is no need to pass |
| 733 | // |initiator_policy_container_keep_alive_handle|, since the initiator |
| 734 | // PolicyContainerHost is kept alive by LocalFrame's PolicyContainer. |
Arthur Hemery | d3011f6 | 2018-05-30 10:38:44 | [diff] [blame] | 735 | // TODO(ahemery): |navigation_client| should not be optional. Make it |
Nasko Oskov | d22f9bf87 | 2020-12-23 00:31:35 | [diff] [blame] | 736 | // mandatory. |
Rakina Zata Amni | af55b5b6 | 2022-07-19 23:11:03 | [diff] [blame] | 737 | // |renderer_cancellation_listener| is a per-navigation interface used to |
| 738 | // listen to the end of the renderer-initiated navigation cancelation window |
| 739 | // for this navigation. See comment for NavigationRendererCancellationListener |
| 740 | // for more details. |
Arthur Hemery | 7b67a97 | 2017-12-01 15:24:49 | [diff] [blame] | 741 | BeginNavigation( |
Minggang Wang | b9f3fa9 | 2021-07-01 15:30:31 | [diff] [blame] | 742 | blink.mojom.CommonNavigationParams common_params, |
| 743 | blink.mojom.BeginNavigationParams begin_params, |
Julie Jeongeun Kim | 249cfbb | 2019-08-30 06:44:05 | [diff] [blame] | 744 | pending_remote<blink.mojom.BlobURLToken>? blob_url_token, |
Julie Jeongeun Kim | ed2e5ba7 | 2019-09-12 10:14:17 | [diff] [blame] | 745 | pending_associated_remote<NavigationClient>? navigation_client, |
Antonio Sartori | db967c5 | 2021-01-20 09:54:30 | [diff] [blame] | 746 | pending_remote<blink.mojom.PolicyContainerHostKeepAliveHandle>? |
Rakina Zata Amni | af55b5b6 | 2022-07-19 23:11:03 | [diff] [blame] | 747 | initiator_policy_container_keep_alive_handle, |
| 748 | pending_receiver<NavigationRendererCancellationListener> |
| 749 | renderer_cancellation_listener); |
John Abd-El-Malek | d488264 | 2017-12-04 21:45:19 | [diff] [blame] | 750 | |
| 751 | // Sent when a subresource response has started. |
Yoshisato Yanagisawa | 66845bf | 2022-05-12 04:04:02 | [diff] [blame] | 752 | // |
| 753 | // |final_response_url| is the final (after all redirects) URL of the |
| 754 | // subresource response. The full URL is not available, because in some |
| 755 | // cases the path and query may be sanitized away |
| 756 | // - see https://crbug.com/973885. |
| 757 | // |
Jay Civelli | d5904f0 | 2018-03-23 19:43:57 | [diff] [blame] | 758 | // |cert_status| is the bitmask of status info of the SSL certificate. (see |
| 759 | // net/cert/cert_status_flags.h). |
Yoshisato Yanagisawa | 66845bf | 2022-05-12 04:04:02 | [diff] [blame] | 760 | SubresourceResponseStarted( |
| 761 | url.mojom.SchemeHostPort final_response_url, |
| 762 | uint32 cert_status); |
Jay Civelli | d5904f0 | 2018-03-23 19:43:57 | [diff] [blame] | 763 | |
Jay Civelli | 116683f | 2018-03-27 19:56:23 | [diff] [blame] | 764 | // Sent when a resource load finished, successfully or not. |
Minggang Wang | ee5af39 | 2020-02-05 02:55:28 | [diff] [blame] | 765 | ResourceLoadComplete(blink.mojom.ResourceLoadInfo url_load_info); |
Luciano Pacheco | 8def47f | 2017-12-07 06:52:30 | [diff] [blame] | 766 | |
| 767 | // Sent when the frame changes its window.name. |
| 768 | DidChangeName(string name, string unique_name); |
| 769 | |
Austin Tankiang | 10d6483 | 2017-12-20 02:43:55 | [diff] [blame] | 770 | // If a cross-process navigation was started for the initial history load in |
| 771 | // this subframe, this tries to cancel it to allow a client redirect to happen |
| 772 | // instead. |
| 773 | CancelInitialHistoryLoad(); |
| 774 | |
| 775 | // Change the encoding name of the page in UI when the page has detected |
| 776 | // proper encoding name. Sent for top-level frames. |
| 777 | UpdateEncoding(string encoding_name); |
Lucas Furukawa Gadani | e5d27a36 | 2018-02-13 14:26:02 | [diff] [blame] | 778 | |
Michael Thiessen | e566352 | 2022-05-25 21:23:28 | [diff] [blame] | 779 | // Updates information to determine whether a user gesture should carryover to |
| 780 | // future navigations. This is needed so navigations within a certain |
| 781 | // timeframe of a request initiated by a gesture will be treated as if they |
| 782 | // were initiated by a gesture too, otherwise the navigation may be blocked. |
| 783 | [EnableIf=is_android] |
| 784 | UpdateUserGestureCarryoverInfo(); |
| 785 | |
Gyuyoung Kim | bc7dee64 | 2020-06-17 01:43:29 | [diff] [blame] | 786 | // Notifies the browser that this frame has new session history information. |
Ken Rockot | 4da6ac0 | 2020-10-27 01:28:25 | [diff] [blame] | 787 | // |
| 788 | // NOTE: PageState can be quite large when serialized, and its message |
| 789 | // structure must remain stable; hence [UnlimitedSize] for this message. |
| 790 | [UnlimitedSize] |
Gyuyoung Kim | bc7dee64 | 2020-06-17 01:43:29 | [diff] [blame] | 791 | UpdateState(PageState state); |
Gyuyoung Kim | 0028790a | 2020-06-26 00:09:00 | [diff] [blame] | 792 | |
| 793 | // Requests that the given URL be opened in the specified manner. |
Yeunjoo Choi | 9232ea3 | 2021-03-08 16:25:17 | [diff] [blame] | 794 | OpenURL(blink.mojom.OpenURLParams params); |
Gyuyoung Kim | 847ecc7 | 2020-07-21 14:07:55 | [diff] [blame] | 795 | |
| 796 | // Called when the renderer is done loading a frame. |
| 797 | DidStopLoading(); |
ben | 76f52b24 | 2016-06-18 05:42:48 | [diff] [blame] | 798 | }; |