blob: c7ad51a01c8114bccaf2703a975c49e02c85977a [file] [log] [blame]
ben76f52b242016-06-18 05:42:481// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5module content.mojom;
6
Dave Tapuskafc4adbae2020-12-02 22:08:597import "cc/mojom/browser_controls_state.mojom";
Arthur Hemery9c035732019-01-07 16:12:418import "content/common/frame_messages.mojom";
Jeremy Roman62fee222019-07-09 17:34:149import "content/common/native_types.mojom";
Arthur Hemeryd3011f62018-05-30 10:38:4410import "content/common/navigation_client.mojom";
Arthur Hemery7b67a972017-12-01 15:24:4911import "content/common/navigation_params.mojom";
Miyoung Shin072d4052020-07-13 07:52:4412import "content/common/web_ui.mojom";
csharrison95f01e922017-04-24 18:52:3513import "content/public/common/window_container_type.mojom";
Mario Sanchez Prada13bbad52020-06-01 18:12:2914import "mojo/public/mojom/base/file_path.mojom";
Ken Rockot8b447d72018-02-03 20:30:4715import "mojo/public/mojom/base/string16.mojom";
Dominic Mazzoni77d0aba2021-01-14 09:42:1616import "mojo/public/mojom/base/time.mojom";
Oksana Zhuravlova34579e912018-03-23 00:18:4917import "mojo/public/mojom/base/unguessable_token.mojom";
Hajime Hoshi35ad74f2019-03-07 08:38:0518import "mojo/public/mojom/base/values.mojom";
arthursonzogni42eabe012020-01-17 15:55:5619import "services/network/public/mojom/content_security_policy.mojom";
Ken Rockot54311e62018-02-10 19:01:5220import "services/network/public/mojom/url_loader.mojom";
Kinuko Yasudad795ac72018-07-11 08:07:5321import "services/network/public/mojom/url_loader_factory.mojom";
arthursonzogni42eabe012020-01-17 15:55:5622import "services/network/public/mojom/url_response_head.mojom";
Ken Rockot543f5e32018-02-04 02:13:5023import "services/service_manager/public/mojom/interface_provider.mojom";
Lucas Furukawa Gadani7bca98a2019-12-11 21:44:2524import "services/viz/public/mojom/compositing/frame_sink_id.mojom";
Miyoung Shin99505dd2019-07-27 12:45:3525import "services/viz/public/mojom/compositing/surface_id.mojom";
Blink Reformata30d4232018-04-07 15:31:0626import "third_party/blink/public/mojom/blob/blob_url_store.mojom";
Dave Tapuska4e60c232020-11-05 15:49:3227import "third_party/blink/public/mojom/browser_interface_broker.mojom";
Julie Jeongeun Kim42a90df2019-03-20 23:13:1028import "third_party/blink/public/mojom/commit_result/commit_result.mojom";
Lowell Mannersf03ea5a2019-04-23 11:47:5829import "third_party/blink/public/mojom/devtools/console_message.mojom";
Kevin McNeeea7f3b82020-02-27 21:42:3230import "third_party/blink/public/mojom/devtools/devtools_agent.mojom";
Gyuyoung Kim16a12f52020-12-19 04:24:2631import "third_party/blink/public/mojom/frame/frame.mojom";
Dave Tapuska4e60c232020-11-05 15:49:3232import "third_party/blink/public/mojom/frame/frame_owner_element_type.mojom";
33import "third_party/blink/public/mojom/frame/frame_owner_properties.mojom";
34import "third_party/blink/public/mojom/frame/frame_policy.mojom";
Dave Tapuskad6703f912019-01-31 23:13:1135import "third_party/blink/public/mojom/frame/lifecycle.mojom";
Andy Paicuc93d30862018-10-10 15:33:4536import "third_party/blink/public/mojom/frame/navigation_initiator.mojom";
Antonio Sartori7f809cc72020-10-30 07:47:2037import "third_party/blink/public/mojom/frame/policy_container.mojom";
Dave Tapuska4e60c232020-11-05 15:49:3238import "third_party/blink/public/mojom/frame/tree_scope_type.mojom";
Minggang Wangee5af392020-02-05 02:55:2839import "third_party/blink/public/mojom/loader/resource_load_info.mojom";
Hiroki Nakagawa753758342018-12-27 04:13:4940import "third_party/blink/public/mojom/loader/url_loader_factory_bundle.mojom";
Yuzu Saijoaae91702019-03-13 07:38:0541import "third_party/blink/public/mojom/messaging/transferable_message.mojom";
Yuzu Saijod46f498a2020-08-04 02:56:2242import "third_party/blink/public/mojom/page/page.mojom";
Dave Tapuska8499eec2020-03-16 17:54:3043import "third_party/blink/public/mojom/page/widget.mojom";
Lucas Furukawa Gadani89a74182019-01-10 19:33:2244import "third_party/blink/public/mojom/portal/portal.mojom";
Hiroki Nakagawa60693aa2020-07-16 09:01:4145import "third_party/blink/public/mojom/loader/referrer.mojom";
Hiroki Nakagawacdbc7912018-11-30 11:30:0546import "third_party/blink/public/mojom/service_worker/controller_service_worker.mojom";
Hiroki Nakagawa077f20962020-05-15 08:04:4447import "third_party/blink/public/mojom/service_worker/service_worker_container.mojom";
Chris Hamiltona46b15442020-07-31 14:38:5648import "third_party/blink/public/mojom/tokens/tokens.mojom";
Dave Tapuska9a31f412020-07-20 17:01:2849import "third_party/blink/public/mojom/widget/visual_properties.mojom";
Julie Jeongeun Kim42a90df2019-03-20 23:13:1050import "third_party/blink/public/mojom/window_features/window_features.mojom";
Mario Sanchez Prada5d7f1ac2020-07-16 17:18:4051import "ui/accessibility/mojom/ax_tree_update.mojom";
Julie Jeongeun Kim2b1d45a2019-06-28 23:37:5452import "ui/base/mojom/window_open_disposition.mojom";
Miyoung Shin87943f502019-07-26 13:31:5853import "ui/gfx/geometry/mojom/geometry.mojom";
Kevin McNeeea7f3b82020-02-27 21:42:3254import "url/mojom/origin.mojom";
55import "url/mojom/url.mojom";
ben76f52b242016-06-18 05:42:4856
Miyoung Shin5d77f72072020-10-09 15:14:2057[Native]
58struct PageState;
59
Mario Sanchez Prada13bbad52020-06-01 18:12:2960// Provided with each call to Frame::GetSerializedHtmlWithLocalLinks() so that
61// the renderer can notify the browser process each time that a chunk of HTML
62// data gets serialized, as well as when the entire process is finished.
63interface FrameHTMLSerializerHandler {
64 // Sent by the renderer as a response to GetSerializedHtmlWithLocalLinks() to
65 // indicate that HTML data has been serialized, included in |data_buffer|.
66 DidReceiveData(string data_buffer);
67
68 // Reports that the serialization process is finished. It is expected to
69 // receive this message right after the last time DidReceiveData() is called.
70 Done();
71};
72
Dominic Mazzoni77d0aba2021-01-14 09:42:1673struct SnapshotAccessibilityTreeParams {
74 // See ui/accessibility/ax_mode.h for valid values of |ax_mode|.
75 uint32 ax_mode;
76
77 // If true, nodes that are entirely offscreen will have their entire
78 // subtree excluded. Note that this heuristic is imperfect, and
79 // an absolute-positioned node that's visible, but whose ancestors
80 // are entirely offscreen, may get excluded.
81 bool exclude_offscreen;
82
83 // The maximum number of nodes to snapshot before exiting early.
84 // Note that this is not a hard limit; once this limit is reached a
85 // few more nodes may be added in order to ensure a well-formed
86 // tree is returned. Use 0 for no max. The corresponding C++ code
87 // uses size_t.
88 uint64 max_nodes;
89
90 // The maximum amount of time to spend snapshotting the tree. Like
91 // max_nodes, this is not a hard limit, and once this limit is reached
92 // a few more nodes may be added in order to ensure a well-formed tree.
93 // Use 0 for no timeout.
94 mojo_base.mojom.TimeDelta timeout;
95};
96
Dave Tapuska795de45a2021-01-12 20:48:0597// An enumeration specifying the reason of the frame deletion.
98enum FrameDeleteIntention {
99 // The frame being deleted isn't a (speculative) main frame.
100 kNotMainFrame,
101 // The frame being deleted is a speculative main frame, and it is being
102 // deleted as part of the shutdown for that WebContents. The entire RenderView
103 // etc will be destroyed by a separate IPC sent later.
104 kSpeculativeMainFrameForShutdown,
105 // The frame being deleted is a speculative main frame, and it is being
106 // deleted because the speculative navigation was cancelled. This is not part
107 // of shutdown.
108 kSpeculativeMainFrameForNavigationCancelled,
109};
110
danakj0bdfacd2021-01-20 19:27:18111// Implemented by the frame provider, and must be associated with other content
112// mojoms bound to frames, widgets, views, and currently also with the legacy
113// IPC channel.
Arthur Hemeryd3011f62018-05-30 10:38:44114// KEEP THE COMMIT FUNCTIONS IN SYNC in content/common/navigation_client.mojom.
danakj0bdfacd2021-01-20 19:27:18115// These will eventually be removed from Frame.
116interface Frame {
clamyaf4bf2d92018-02-06 10:54:36117 // Tells the renderer that a same-document navigation should be committed.
118 // The renderer will return a status value indicating whether the commit
119 // could proceed as expected or not. In particular, it might be necessary to
120 // restart the navigation if it is no-longer same-document, which can happen
121 // if the renderer committed another navigation in the meantime.
122 CommitSameDocumentNavigation(
123 CommonNavigationParams common_params,
Nasko Oskovc36327d2019-01-03 23:23:04124 CommitNavigationParams request_params)
clamyaf4bf2d92018-02-06 10:54:36125 => (blink.mojom.CommitResult commit_result);
126
clamyb1df7b962018-02-01 17:38:17127 // Asks the renderer to handle a renderer-debug URL.
128 HandleRendererDebugURL(url.mojom.Url url);
129
Chong Zhang7306b0b2018-01-24 05:59:24130 // Provides the renderer an updated |subresource_loader_factories|.
131 //
132 // This method is intended to fix broken loaders after a Network Service
133 // crash, and is only used when Network Service is enabled.
134 //
135 // The new bundle contains replacement factories for a subset of the
136 // receiver's existing bundle.
137 UpdateSubresourceLoaderFactories(
Hiroki Nakagawa753758342018-12-27 04:13:49138 blink.mojom.URLLoaderFactoryBundle subresource_loader_factories);
Dmitry Gozman6adf95b2018-10-10 22:12:19139
140 // Returns a DevToolsAgent interface for this frame, used for
141 // remote debugging. See DevToolsAgent for details.
142 // Returned DevToolsAgent must be associated with navigation control,
143 // due to various ordering dependencies between DevTools protocol and
144 // navigation.
Julie Jeongeun Kim07887792019-08-13 11:05:48145 BindDevToolsAgent(
146 pending_associated_remote<blink.mojom.DevToolsAgentHost> agent_host,
Andrey Kosyakov5bb020f2020-03-19 17:28:19147 pending_associated_receiver<blink.mojom.DevToolsAgent> agent);
Hajime Hoshi35ad74f2019-03-07 08:38:05148
Maksim Sadymcfb8f8d2020-09-30 20:30:45149 // Request for the renderer to execute a given JavaScript method on a given
150 // object (both identified by name) in the frame's context.
151 //
152 // |object_name| is the global name of the object.
153 //
154 // |method_name| is the name of the method on the object.
155 //
156 // |arguments| is the list of arguments to pass to the method invocation.
157 //
158 // |wants_result| is true if the result of this execution is required by the
159 // caller. If it is false, a reply is still required by Mojo, but a null value
160 // should be returned to avoid issues serializing a large, unwanted reply.
161 JavaScriptMethodExecuteRequest(
162 mojo_base.mojom.String16 object_name,
163 mojo_base.mojom.String16 method_name,
164 mojo_base.mojom.ListValue arguments,
165 bool wants_result) => (mojo_base.mojom.Value result);
166
Hajime Hoshi35ad74f2019-03-07 08:38:05167 // Request for the renderer to execute JavaScript in the frame's context.
168 //
169 // |javascript| is the string containing the JavaScript to be executed in the
Avi Drissman90630d92020-04-29 21:17:36170 // target frame's context. Note that this uses BigString16 rather than
171 // String16 as this is used in contexts, like DevTools, where the contents of
172 // the JavaScript script is user-provided, and therefore we can't guarantee
173 // the size of the script.
Hajime Hoshi35ad74f2019-03-07 08:38:05174 //
Avi Drissman8e3ebe92019-06-10 20:26:11175 // |wants_result| is true if the result of this execution is required by the
176 // caller. If it is false, a reply is still required by Mojo, but a null value
177 // should be returned to avoid issues serializing a large, unwanted reply.
178 //
Hajime Hoshi35ad74f2019-03-07 08:38:05179 // TODO(hajimehoshi): This requires navigate association to keep the message
180 // order with other navigation-related messages. Fix this and move this to a
181 // non-navigate-related interface if possible.
Avi Drissman4544828f2019-03-11 20:37:32182 JavaScriptExecuteRequest(
Avi Drissman90630d92020-04-29 21:17:36183 mojo_base.mojom.BigString16 javascript,
Avi Drissman8e3ebe92019-06-10 20:26:11184 bool wants_result) => (mojo_base.mojom.Value result);
Hajime Hoshi35ad74f2019-03-07 08:38:05185
Mustaq Ahmed02cd8832019-12-05 15:46:56186 // ONLY FOR TESTS: Same as above but this can optionally trigger a fake user
187 // activation notification to test functionalities that are gated by user
188 // activation.
Avi Drissman4544828f2019-03-11 20:37:32189 JavaScriptExecuteRequestForTests(
Avi Drissman90630d92020-04-29 21:17:36190 mojo_base.mojom.BigString16 javascript,
Avi Drissman8e3ebe92019-06-10 20:26:11191 bool wants_result,
Hajime Hoshif85e7cf722019-07-19 00:54:49192 bool has_user_gesture,
193 int32 world_id)
Avi Drissman4544828f2019-03-11 20:37:32194 => (mojo_base.mojom.Value result);
Hajime Hoshi35ad74f2019-03-07 08:38:05195
196 // Same as JavaScriptExecuteRequest above except the script is run in the
197 // isolated world specified by the fourth parameter.
Avi Drissman4544828f2019-03-11 20:37:32198 JavaScriptExecuteRequestInIsolatedWorld(
Avi Drissman90630d92020-04-29 21:17:36199 mojo_base.mojom.BigString16 javascript,
Avi Drissman8e3ebe92019-06-10 20:26:11200 bool wants_result,
Avi Drissman4544828f2019-03-11 20:37:32201 int32 world_id) => (mojo_base.mojom.Value result);
Yuzu Saijoaae91702019-03-13 07:38:05202
Ian Barkley-Yeungbda77fb2020-12-08 04:26:46203 // Indicates that the frame host (browser) wants the |untrusted_stack_trace|
204 // parameter of DidAddMessageToConsole() filled in for Error messages if at
205 // all possible.
206 SetWantErrorMessageStackTrace();
207
Dave Tapuskaca250702021-01-07 17:40:55208 // Unload this RenderFrame and replace it by a RenderFrameProxy, so the frame
209 // can navigate to a document rendered by a different process. The unload can
210 // fail if the RenderFrame is currently detached (it was removed from the
211 // frame tree before the Unload was received). If successful this message will
212 // send back AgentSchedulingGroupHost::DidUnloadRenderFrame message. This
213 // cannot be a standard reply callback because the unload acknowledgement must
214 // be posted back to the event loop to be invoked later. This is to ensure
215 // that any postMessage() calls executed by JS during unload are dispatched,
216 // since postMessage dispatch is always scheduled asynchronously.
217 Unload(int32 new_remote_frame_routing_id,
218 bool is_loading,
219 FrameReplicationState new_remote_frame_replication_state,
220 mojo_base.mojom.UnguessableToken new_remote_frame_token);
Dave Tapuska795de45a2021-01-12 20:48:05221
222 // Delete the frame. This is only called for child frames that the browser
223 // wants to detach, or for speculative main frames which are owned by the
224 // browser process. Committed main frames are owned by the renderer's WebView
225 // and can not be deleted directly.
226 Delete(FrameDeleteIntention intention);
danakj0bdfacd2021-01-20 19:27:18227
228 // Causes all new subresource requests to be blocked (not being started) until
229 // ResumeBlockedRequests is called.
230 BlockRequests();
231
232 // Resumes blocked requests.
233 // It is safe to call this without calling BlockRequests.
234 ResumeBlockedRequests();
235
236 GetInterfaceProvider(
237 pending_receiver<service_manager.mojom.InterfaceProvider> interfaces);
238
239 GetCanonicalUrlForSharing() => (url.mojom.Url? canonical_url);
240
241 // Samsung Galaxy Note-specific "smart clip" stylus text getter.
242 // Extracts the data at the given rect.
243 [EnableIf=is_android]
244 ExtractSmartClipData(gfx.mojom.Rect rect)
245 => (mojo_base.mojom.String16 text, mojo_base.mojom.String16 html,
246 gfx.mojom.Rect clip_rect);
247
248 // Requests a one-time snapshot of the accessibility tree without enabling
249 // accessibility if it wasn't already enabled.
250 SnapshotAccessibilityTree(SnapshotAccessibilityTreeParams params)
251 => (ax.mojom.AXTreeUpdate snapshot);
252
253 // Get HTML data by serializing the target frame and replacing all resource
254 // links with a path to the local copy passed in the message payload. In order
255 // to report progress to the the browser process, a pending remote is passed
256 // via |callback_remote|, so that direct communication with the SavePackage
257 // object that initiated the process can be established.
258 GetSerializedHtmlWithLocalLinks(
259 map<url.mojom.Url, mojo_base.mojom.FilePath> url_map,
260 map<mojo_base.mojom.UnguessableToken, mojo_base.mojom.FilePath>
261 frame_token_map, bool save_with_empty_url,
262 pending_remote<FrameHTMLSerializerHandler> handler_remote);
Ken Rockot48785452017-10-25 19:33:14263};
264
sammc7f6c6a02017-01-30 00:53:51265// Implemented by the frame (e.g. renderer processes).
266// Instances of this interface must be associated with (i.e., FIFO with) the
267// legacy IPC channel.
268interface FrameBindingsControl {
269 // Used to tell a render frame whether it should expose various bindings
270 // that allow JS content extended privileges. See BindingsPolicy for valid
271 // flag values.
272 AllowBindings(int32 enabled_bindings_flags);
Nasko Oskov8a73f7d2019-09-27 22:29:32273
274 // Used to tell the RenderFrame to enable Mojo JS bindings, which allows
275 // JS code running in the renderer process to connect to Mojo interfaces
276 // and make method calls on them.
277 // This is used for WebUI only at this time.
278 EnableMojoJsBindings();
Miyoung Shin072d4052020-07-13 07:52:44279
280 // Used to bind WebUI and WebUIHost mojo connections.
Daniel Cheng4b931a4f2020-12-18 01:59:35281 BindWebUI(pending_associated_receiver<content.mojom.WebUI> receiver,
282 pending_associated_remote<content.mojom.WebUIHost> remote);
sammc7f6c6a02017-01-30 00:53:51283};
284
csharrison95f01e922017-04-24 18:52:35285struct CreateNewWindowParams {
Mustaq Ahmed8601a562020-01-31 18:05:52286 // True if ContentRendererClient allows popups. This is the case only for
287 // extensions.
288 bool allow_popup;
csharrison95f01e922017-04-24 18:52:35289
290 // Type of window requested.
291 WindowContainerType window_container_type;
292
293 // The session storage namespace ID this window should use.
Daniel Murphy31bbb8b12018-02-07 21:44:10294 string session_storage_namespace_id;
csharrison95f01e922017-04-24 18:52:35295
Daniel Murphye3eec92c2018-02-23 19:09:15296 // The session storage namespace ID this window should clone from.
297 // TODO(dmurph): Remove this once session storage is fully mojo'd, as the
298 // clone call happens on a different interface. https://crbug.com/716490
299 string clone_from_session_storage_namespace_id;
300
csharrison95f01e922017-04-24 18:52:35301 // The name of the resulting frame that should be created (empty if none
302 // has been specified). UTF8 encoded string.
303 string frame_name;
304
csharrison95f01e922017-04-24 18:52:35305 // Whether the opener will be suppressed in the new window, in which case
306 // scripting the new window is not allowed.
307 bool opener_suppressed;
308
309 // Whether the window should be opened in the foreground, background, etc.
310 ui.mojom.WindowOpenDisposition disposition;
311
312 // The URL that will be loaded in the new window (empty if none has been
313 // specified).
314 url.mojom.Url target_url;
315
316 // The referrer that will be used to load |target_url| (empty if none has
317 // been specified).
318 blink.mojom.Referrer referrer;
319
320 // The window features to use for the new window.
321 blink.mojom.WindowFeatures features;
John Delaney8623c642021-01-06 17:37:07322
323 // The impression associated with the navigation in the new window, if
324 // one is specified.
325 Impression? impression;
csharrison95f01e922017-04-24 18:52:35326};
327
Daniel Cheng8bb30c62017-10-23 20:40:47328// Operation result when the renderer asks the browser to create a new window.
329enum CreateNewWindowStatus {
330 // Ignore creation of the new window. This can happen because creation is
331 // blocked or because the new window should have no opener relationship.
332 kIgnore,
333 // Reuse the current window rather than creating a new window.
334 kReuse,
335 // Create a new window using the corresponding params in |reply|.
336 kSuccess,
337};
338
339// All routing IDs in this struct must be set to a valid routing ID.
csharrison95f01e922017-04-24 18:52:35340struct CreateNewWindowReply {
Daniel Cheng8bb30c62017-10-23 20:40:47341 // The ID of the view to be created.
csharrison95f01e922017-04-24 18:52:35342 int32 route_id;
343
344 // The ID of the main frame hosted in the view.
345 int32 main_frame_route_id;
346
danakj0bdfacd2021-01-20 19:27:18347 // The pending mojo connection to the Frame implementation in the renderer.
348 pending_associated_receiver<content.mojom.Frame> frame;
349
Dave Tapuska84449382020-05-01 00:39:04350 // The unique identifier of the RenderFrameHost
351 mojo_base.mojom.UnguessableToken main_frame_frame_token;
352
csharrison95f01e922017-04-24 18:52:35353 // The ID of the widget for the main frame.
354 int32 main_frame_widget_route_id;
355
danakjbe56b8132019-10-12 00:57:41356 // Initial properties for the main frame RenderWidget.
Dave Tapuska9a31f412020-07-20 17:01:28357 blink.mojom.VisualProperties visual_properties;
danakjbe56b8132019-10-12 00:57:41358
Dave Tapuska8499eec2020-03-16 17:54:30359 // The communication interfaces for the WebFrameWidget in blink.
360 pending_associated_remote<blink.mojom.FrameWidgetHost> frame_widget_host;
361 pending_associated_receiver<blink.mojom.FrameWidget> frame_widget;
362 pending_associated_remote<blink.mojom.WidgetHost> widget_host;
363 pending_associated_receiver<blink.mojom.Widget> widget;
364
Yuzu Saijod46f498a2020-08-04 02:56:22365 // The communication interfaces for the PageBroadcast.
366 pending_associated_receiver<blink.mojom.PageBroadcast> page_broadcast;
367
Ken Rockotc4a0ada92020-12-02 00:22:14368 pending_remote<blink.mojom.BrowserInterfaceBroker>
369 main_frame_interface_broker;
Balazs Engedyba034e72017-10-27 22:26:28370
csharrison95f01e922017-04-24 18:52:35371 // Duplicated from CreateNewWindowParams because legacy code.
Daniel Murphy31bbb8b12018-02-07 21:44:10372 string cloned_session_storage_namespace_id;
Pavel Feldman08beed7842017-10-17 19:18:11373
374 // Used for devtools instrumentation and trace-ability. The token is
375 // propagated to Blink's LocalFrame and both Blink and content/
376 // can tag calls and requests with this instrumentation token in order to
377 // attribute them to the context frame.
378 // |devtools_frame_token| is only defined by the browser and is never
379 // sent back from the renderer in the control calls.
Oksana Zhuravlova34579e912018-03-23 00:18:49380 mojo_base.mojom.UnguessableToken devtools_main_frame_token;
Yury Semikhatsky82730ff2020-02-25 22:29:26381
382 // Used by devtools instrumentation to tell devtools agent in the renderer
383 // that it should pause created window and wait for an explicit resume command
384 // from the client.
385 bool wait_for_debugger;
Antonio Sartori7f809cc72020-10-30 07:47:20386
387 // The policy container for the new frame that will be created by Blink in
388 // response.
Antonio Sartori9290b6b2020-11-09 10:09:33389 blink.mojom.PolicyContainer policy_container;
csharrison95f01e922017-04-24 18:52:35390};
391
Gyuyoung Kim0028790a2020-06-26 00:09:00392// This struct holds parameters included in the OpenURL method sent by the
393// renderer to the browser, |is_history_navigation_in_new_child_frame| is true
394// in the case that the browser process should look for an existing history item
395// for the frame.
396struct OpenURLParams {
397 // The main URL to open.
398 url.mojom.Url url;
399 url.mojom.Origin initiator_origin;
Antonio Sartori9a82f6f32020-12-14 09:22:45400
401 // The token of the RenderFrameHost that initiated the navigation. It might
402 // refer to a RenderFrameHost that doesn't exist anymore when the IPC reaches
403 // the browser process.
404 mojo_base.mojom.UnguessableToken? initiator_frame_token;
405
Gyuyoung Kim0028790a2020-06-26 00:09:00406 network.mojom.URLRequestBody? post_body;
407 string extra_headers;
408 blink.mojom.Referrer referrer;
409
410 // The window position to open the URL.
411 ui.mojom.WindowOpenDisposition disposition;
412 bool should_replace_current_entry;
413 bool user_gesture;
414
415 // Extra information about the triggering of the OpenURL.
Gyuyoung Kim16a12f52020-12-19 04:24:26416 blink.mojom.TriggeringEventInfo triggering_event_info;
Daniel Cheng13251e52020-11-25 17:41:23417 pending_remote<blink.mojom.BlobURLToken>? blob_url_token;
Gyuyoung Kim0028790a2020-06-26 00:09:00418 string href_translate;
419 Impression? impression;
420 NavigationDownloadPolicy download_policy;
Antonio Sartoridb967c52021-01-20 09:54:30421
422 // Passing the |initiator_policy_container_keep_alive_handle| is just a mean
423 // to ensure that the PolicyContainerHost of the initiator RenderFrameHost is
424 // kept alive, even if the RenderFrameHost itself has already been deleted in
425 // the meantime. If this can be ensured in other ways, it is safe to pass a
426 // mojo::NullRemote here.
427 pending_remote<blink.mojom.PolicyContainerHostKeepAliveHandle>?
428 initiator_policy_container_keep_alive_handle;
Gyuyoung Kim0028790a2020-06-26 00:09:00429};
430
csharrison95f01e922017-04-24 18:52:35431// Implemented by the frame server (i.e. the browser process). For messages that
432// must be associated with the IPC channel.
433interface FrameHost {
Daniel Cheng8bb30c62017-10-23 20:40:47434 // Sent by the renderer to request the browser to create a new window. |reply|
435 // is only non-null on when status == CreateNewWindowStatus::kSuccess.
csharrison95f01e922017-04-24 18:52:35436 [Sync] CreateNewWindow(CreateNewWindowParams params)
Daniel Cheng8bb30c62017-10-23 20:40:47437 => (CreateNewWindowStatus status, CreateNewWindowReply? reply);
Yutaka Hiranof7f2f632017-09-06 10:40:08438
Lucas Furukawa Gadani99125822019-01-03 15:41:49439 // Sent by the renderer process to request the creation of a new portal.
Adithya Srinivasane8bf80e2019-05-01 15:39:31440 // |portal| is the pipe to be used for the Portal object, |client| is the pipe
Dave Tapuska84449382020-05-01 00:39:04441 // used to communicate back with the caller. Returns:
442 // |proxy_routing_id| - the routing id of the RenderFrameProxy
443 // |initial_replicated_state| - the replicated state associated with that
444 // RenderFrameProxy
445 // |portal_token| - the unique identifier for the portal
446 // |frame_token| - the unique identifier of the RenderFrameProxy
447 // |devtools_frame_token| - the unique identifier of the frame node in the
448 // frame tree
Jeremy Romand92e1372019-06-04 16:31:17449 [Sync] CreatePortal(
450 pending_associated_receiver<blink.mojom.Portal> portal,
451 pending_associated_remote<blink.mojom.PortalClient> client)
Lucas Furukawa Gadani99125822019-01-03 15:41:49452 => (int32 proxy_routing_id,
Kevin McNee51ef5dc2020-01-13 17:52:37453 FrameReplicationState initial_replicated_state,
Adithya Srinivasanea4760c2020-07-30 15:44:57454 blink.mojom.PortalToken portal_token,
Dave Tapuska84449382020-05-01 00:39:04455 mojo_base.mojom.UnguessableToken frame_token,
Lucas Furukawa Gadanif68204d2019-04-30 17:30:24456 mojo_base.mojom.UnguessableToken devtools_frame_token);
Lucas Furukawa Gadani99125822019-01-03 15:41:49457
Lucas Furukawa Gadani56dd5452019-03-22 18:23:12458 // Requests that this frame adopts the portal identified by |portal_token|.
Dave Tapuska84449382020-05-01 00:39:04459 // Returns:
460 // |proxy_routing_id| - the routing id of the portal's RenderFrameProxy
461 // |replicated_state| - the replicated state associated with that
462 // RenderFrameProxy
463 // |frame_token| - the unique identifier of the RenderFrameProxy
464 // |devtools_frame_token| - the unique identifier of the frame node in the
465 // frame tree
Adithya Srinivasanea4760c2020-07-30 15:44:57466 [Sync] AdoptPortal(blink.mojom.PortalToken portal_token)
Lucas Furukawa Gadanif68204d2019-04-30 17:30:24467 => (int32 proxy_routing_id,
Lucas Furukawa Gadani7bca98a2019-12-11 21:44:25468 viz.mojom.FrameSinkId frame_sink_id,
Jeremy Roman62fee222019-07-09 17:34:14469 FrameReplicationState replicated_state,
Dave Tapuska84449382020-05-01 00:39:04470 mojo_base.mojom.UnguessableToken frame_token,
Lucas Furukawa Gadanif68204d2019-04-30 17:30:24471 mojo_base.mojom.UnguessableToken devtools_frame_token);
Lucas Furukawa Gadani56dd5452019-03-22 18:23:12472
Dave Tapuskad9835622020-03-10 17:32:31473
474 // Similar to CreateNewWindow, except used for sub-widgets, like <select>
Dave Tapuska04ccda062020-10-21 21:58:12475 // dropdowns. Upon return, the renderer side popup will be owned by the
476 // PopupWidgetHost.
Dave Tapuskad95cfb32020-11-02 17:04:55477 CreateNewPopupWidget(
Dave Tapuska04ccda062020-10-21 21:58:12478 pending_associated_receiver<blink.mojom.PopupWidgetHost> popup_host,
Dave Tapuska8499eec2020-03-16 17:54:30479 pending_associated_receiver<blink.mojom.WidgetHost> blink_widget_host,
Dave Tapuskad95cfb32020-11-02 17:04:55480 pending_associated_remote<blink.mojom.Widget> blink_widget);
Dave Tapuskad9835622020-03-10 17:32:31481
Dave Tapuska4e60c232020-11-05 15:49:32482 // Asynchronously creates a child frame. A routing ID must be allocated first
483 // by calling RenderMessageFilter::GenerateFrameRoutingID()
484 // Each of these messages will have a corresponding mojom::FrameHost::Detach
485 // API sent when the frame is detached from the DOM.
486 CreateChildFrame(int32 child_routing_id,
danakj0bdfacd2021-01-20 19:27:18487 pending_associated_remote<content.mojom.Frame> frame,
Dave Tapuska4e60c232020-11-05 15:49:32488 pending_receiver<blink.mojom.BrowserInterfaceBroker>
489 browser_interface_broker,
Antonio Sartoridb967c52021-01-20 09:54:30490 blink.mojom.PolicyContainerBindParams
491 policy_container_bind_params,
Dave Tapuska4e60c232020-11-05 15:49:32492 blink.mojom.TreeScopeType scope,
493 string frame_name,
494 string frame_unique_name,
495 bool is_created_by_script,
496 blink.mojom.FramePolicy frame_policy,
497 blink.mojom.FrameOwnerProperties frame_owner_properties,
498 blink.mojom.FrameOwnerElementType frame_owner_element_type);
499
Balazs Engedya40712f2017-09-15 15:01:11500 // Sent by the renderer when a navigation commits in the frame.
Oksana Zhuravlova8b88e572019-01-07 21:54:00501
502 // If |interface_params| is non-empty, the FrameHost implementation
Ken Rockot228182e2020-12-01 18:43:59503 // must unbind the old BrowserInterfaceBroker connections, and drop any
504 // interface requests pending on them. Then it should bind the appropriate
505 // requests and start servicing GetInterface messages coming in on these new
506 // connections in a security context that is appropriate for the committed
507 // navigation.
Balazs Engedy0c8d550b2017-12-06 21:30:23508 //
Oksana Zhuravlova8b88e572019-01-07 21:54:00509 // The FrameHost implementation must enforce that |interface_params|
Balazs Engedy0c8d550b2017-12-06 21:30:23510 // is set for cross-document navigations. This prevents origin confusion by
511 // ensuring that interface requests racing with navigation commit will be
512 // either ignored, or serviced correctly in the security context of the
Ken Rockot228182e2020-12-01 18:43:59513 // document they originated from (based on which BrowserInterfaceBroker
514 // connection the GetInterface messages arrive on).
Balazs Engedya40712f2017-09-15 15:01:11515 DidCommitProvisionalLoad(
Balazs Engedy0c8d550b2017-12-06 21:30:23516 DidCommitProvisionalLoadParams params,
Oksana Zhuravlova8b88e572019-01-07 21:54:00517 DidCommitProvisionalLoadInterfaceParams? interface_params);
Arthur Hemery7b67a972017-12-01 15:24:49518
Arthur Hemery7b0ae492018-02-05 16:04:45519 // Sent by the renderer to indicate that a same document navigation
520 // committed in the renderer process.
521 DidCommitSameDocumentNavigation(
Rakina Zata Amni26357782020-12-03 11:45:01522 DidCommitProvisionalLoadParams params,
523 DidCommitSameDocumentNavigationParams same_document_params);
Arthur Hemery7b0ae492018-02-05 16:04:45524
Arthur Hemery7b67a972017-12-01 15:24:49525 // Sent by the renderer to request a navigation.
Marijn Kruisselbrink07bf59d52018-04-03 21:50:25526 // |blob_url_token| should be non-null when this is a navigation to a blob:
527 // URL. The token will then be used to look up the blob associated with the
528 // blob URL. Without this by the time the navigation code starts fetching
529 // the URL the blob URL might no longer be valid. |blob_url_token| is
530 // not part of BeginNavigationParams because that struct needs to be
531 // cloneable, and thus can't contain mojo interfaces.
532 // If an invalid BlobURLToken is passed in, or if the token doesn't match the
533 // url in |common_params|, the navigation will result in a network error.
Arthur Hemeryd3011f62018-05-30 10:38:44534 // |navigation_client| is passed to the renderer to allow for further control
Nasko Oskovd22f9bf872020-12-23 00:31:35535 // of the navigation. Allows for Commit and Cancels/Aborts.
Antonio Sartoridb967c52021-01-20 09:54:30536 // Passing the |initiator_policy_container_keep_alive_handle| is just a means
537 // to ensure that the PolicyContainerHost of the initiator RenderFrameHost is
538 // kept alive, even if the RenderFrameHost itself has already been deleted in
539 // the meantime. If this can be ensured in other ways, it is safe to pass a
540 // mojo::NullRemote. In particular, if the initiator LocalFrame is alive when
541 // issuing this mojo call, there is no need to pass
542 // |initiator_policy_container_keep_alive_handle|, since the initiator
543 // PolicyContainerHost is kept alive by LocalFrame's PolicyContainer.
Arthur Hemeryd3011f62018-05-30 10:38:44544 // TODO(ahemery): |navigation_client| should not be optional. Make it
Nasko Oskovd22f9bf872020-12-23 00:31:35545 // mandatory.
Arthur Hemery7b67a972017-12-01 15:24:49546 BeginNavigation(
547 CommonNavigationParams common_params,
Marijn Kruisselbrink07bf59d52018-04-03 21:50:25548 BeginNavigationParams begin_params,
Julie Jeongeun Kim249cfbb2019-08-30 06:44:05549 pending_remote<blink.mojom.BlobURLToken>? blob_url_token,
Julie Jeongeun Kimed2e5ba72019-09-12 10:14:17550 pending_associated_remote<NavigationClient>? navigation_client,
Antonio Sartoridb967c52021-01-20 09:54:30551 pending_remote<blink.mojom.NavigationInitiator>? navigation_initiator,
552 pending_remote<blink.mojom.PolicyContainerHostKeepAliveHandle>?
553 initiator_policy_container_keep_alive_handle);
John Abd-El-Malekd4882642017-12-04 21:45:19554
555 // Sent when a subresource response has started.
Jay Civellid5904f02018-03-23 19:43:57556 // |cert_status| is the bitmask of status info of the SSL certificate. (see
557 // net/cert/cert_status_flags.h).
Lukasz Anforowiczd334bba2020-02-10 23:32:55558 SubresourceResponseStarted(url.mojom.Url url, uint32 cert_status);
Jay Civellid5904f02018-03-23 19:43:57559
Jay Civelli116683f2018-03-27 19:56:23560 // Sent when a resource load finished, successfully or not.
Minggang Wangee5af392020-02-05 02:55:28561 ResourceLoadComplete(blink.mojom.ResourceLoadInfo url_load_info);
Luciano Pacheco8def47f2017-12-07 06:52:30562
563 // Sent when the frame changes its window.name.
564 DidChangeName(string name, string unique_name);
565
Austin Tankiang10d64832017-12-20 02:43:55566 // If a cross-process navigation was started for the initial history load in
567 // this subframe, this tries to cancel it to allow a client redirect to happen
568 // instead.
569 CancelInitialHistoryLoad();
570
571 // Change the encoding name of the page in UI when the page has detected
572 // proper encoding name. Sent for top-level frames.
573 UpdateEncoding(string encoding_name);
Lucas Furukawa Gadanie5d27a362018-02-13 14:26:02574
Lucas Gadani471160f92018-03-01 03:13:21575 // The frame's size is replicated in the browser so that the browser can
576 // correctly set the initial size of the frame in case of a cross-process
577 // navigation.
578 FrameSizeChanged(gfx.mojom.Size size);
Becca Hughesfd5d8f892018-06-14 18:23:36579
Clark DuValla0e42992018-09-17 17:00:11580 // Updates information to determine whether a user gesture should carryover to
581 // future navigations. This is needed so navigations within a certain
582 // timeframe of a request initiated by a gesture will be treated as if they
583 // were initiated by a gesture too, otherwise the navigation may be blocked.
584 [EnableIf=is_android]
585 UpdateUserGestureCarryoverInfo();
Lowell Manners9499addc2019-03-12 11:05:32586
Ian Barkley-Yeung07d8a262020-11-19 22:45:35587 // Blink and JavaScript error messages to log to the console, debugger UI, or
588 // error reporting service. |source_id| is usually a URL.
589 // |untrusted_stack_trace| should only be printed or sent to other services;
590 // it's untrusted and should not be parsed to get a structured stack trace.
Ian Barkley-Yeungbda77fb2020-12-08 04:26:46591 // The stack trace is only present if
592 // FrameNavigationControl.SetWantErrorMessageStackTrace has been called for
593 // this frame and the log_level is kError.
Lowell Mannersf03ea5a2019-04-23 11:47:58594 DidAddMessageToConsole(
595 blink.mojom.ConsoleMessageLevel log_level,
596 mojo_base.mojom.BigString16 msg,
597 int32 line_number,
Ian Barkley-Yeung07d8a262020-11-19 22:45:35598 mojo_base.mojom.String16 source_id,
599 mojo_base.mojom.BigString16? untrusted_stack_trace);
Lowell Mannersf03ea5a2019-04-23 11:47:58600
Gyuyoung Kimbc7dee642020-06-17 01:43:29601 // Notifies the browser that this frame has new session history information.
Ken Rockot4da6ac02020-10-27 01:28:25602 //
603 // NOTE: PageState can be quite large when serialized, and its message
604 // structure must remain stable; hence [UnlimitedSize] for this message.
605 [UnlimitedSize]
Gyuyoung Kimbc7dee642020-06-17 01:43:29606 UpdateState(PageState state);
Gyuyoung Kim0028790a2020-06-26 00:09:00607
608 // Requests that the given URL be opened in the specified manner.
609 OpenURL(OpenURLParams params);
Gyuyoung Kim847ecc72020-07-21 14:07:55610
611 // Called when the renderer is done loading a frame.
612 DidStopLoading();
ben76f52b242016-06-18 05:42:48613};