blob: bc1e1f0c5da7321e8a12ba80a4000fba15b46feb [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";
Antonio Sartori90f41212021-01-22 10:08:349import "content/common/frame_replication_state.mojom";
Jeremy Roman62fee222019-07-09 17:34:1410import "content/common/native_types.mojom";
Arthur Hemeryd3011f62018-05-30 10:38:4411import "content/common/navigation_client.mojom";
Arthur Hemery7b67a972017-12-01 15:24:4912import "content/common/navigation_params.mojom";
Miyoung Shin072d4052020-07-13 07:52:4413import "content/common/web_ui.mojom";
csharrison95f01e922017-04-24 18:52:3514import "content/public/common/window_container_type.mojom";
Daniel Chengd1b775552021-02-19 18:50:0215import "ipc/constants.mojom";
Mario Sanchez Prada13bbad52020-06-01 18:12:2916import "mojo/public/mojom/base/file_path.mojom";
Ken Rockot8b447d72018-02-03 20:30:4717import "mojo/public/mojom/base/string16.mojom";
Dominic Mazzoni77d0aba2021-01-14 09:42:1618import "mojo/public/mojom/base/time.mojom";
Oksana Zhuravlova34579e912018-03-23 00:18:4919import "mojo/public/mojom/base/unguessable_token.mojom";
Hajime Hoshi35ad74f2019-03-07 08:38:0520import "mojo/public/mojom/base/values.mojom";
arthursonzogni42eabe012020-01-17 15:55:5621import "services/network/public/mojom/content_security_policy.mojom";
Daniel Chengd1b775552021-02-19 18:50:0222import "services/network/public/mojom/url_loader.mojom";
Dave Tapuska2a6046a2021-03-01 22:42:5223import "services/network/public/mojom/url_loader_factory.mojom";
24import "services/network/public/mojom/url_request.mojom";
arthursonzogni42eabe012020-01-17 15:55:5625import "services/network/public/mojom/url_response_head.mojom";
Ken Rockot543f5e32018-02-04 02:13:5026import "services/service_manager/public/mojom/interface_provider.mojom";
Miyoung Shin99505dd2019-07-27 12:45:3527import "services/viz/public/mojom/compositing/surface_id.mojom";
Blink Reformata30d4232018-04-07 15:31:0628import "third_party/blink/public/mojom/blob/blob_url_store.mojom";
Dave Tapuska4e60c232020-11-05 15:49:3229import "third_party/blink/public/mojom/browser_interface_broker.mojom";
Julie Jeongeun Kim42a90df2019-03-20 23:13:1030import "third_party/blink/public/mojom/commit_result/commit_result.mojom";
Lowell Mannersf03ea5a2019-04-23 11:47:5831import "third_party/blink/public/mojom/devtools/console_message.mojom";
Kevin McNeeea7f3b82020-02-27 21:42:3232import "third_party/blink/public/mojom/devtools/devtools_agent.mojom";
Gyuyoung Kim16a12f52020-12-19 04:24:2633import "third_party/blink/public/mojom/frame/frame.mojom";
Dave Tapuska4e60c232020-11-05 15:49:3234import "third_party/blink/public/mojom/frame/frame_owner_element_type.mojom";
35import "third_party/blink/public/mojom/frame/frame_owner_properties.mojom";
36import "third_party/blink/public/mojom/frame/frame_policy.mojom";
Dave Tapuskad6703f912019-01-31 23:13:1137import "third_party/blink/public/mojom/frame/lifecycle.mojom";
Andy Paicuc93d30862018-10-10 15:33:4538import "third_party/blink/public/mojom/frame/navigation_initiator.mojom";
Antonio Sartori7f809cc72020-10-30 07:47:2039import "third_party/blink/public/mojom/frame/policy_container.mojom";
Dave Tapuska4e60c232020-11-05 15:49:3240import "third_party/blink/public/mojom/frame/tree_scope_type.mojom";
Daniel Chengd1b775552021-02-19 18:50:0241import "third_party/blink/public/mojom/loader/referrer.mojom";
Minggang Wangee5af392020-02-05 02:55:2842import "third_party/blink/public/mojom/loader/resource_load_info.mojom";
Hiroki Nakagawa753758342018-12-27 04:13:4943import "third_party/blink/public/mojom/loader/url_loader_factory_bundle.mojom";
Yuzu Saijoaae91702019-03-13 07:38:0544import "third_party/blink/public/mojom/messaging/transferable_message.mojom";
Yuzu Saijod46f498a2020-08-04 02:56:2245import "third_party/blink/public/mojom/page/page.mojom";
Dave Tapuska8499eec2020-03-16 17:54:3046import "third_party/blink/public/mojom/page/widget.mojom";
Lucas Furukawa Gadani89a74182019-01-10 19:33:2247import "third_party/blink/public/mojom/portal/portal.mojom";
Daniel Chengd1b775552021-02-19 18:50:0248import "third_party/blink/public/mojom/renderer_preferences.mojom";
Hiroki Nakagawacdbc7912018-11-30 11:30:0549import "third_party/blink/public/mojom/service_worker/controller_service_worker.mojom";
Hiroki Nakagawa077f20962020-05-15 08:04:4450import "third_party/blink/public/mojom/service_worker/service_worker_container.mojom";
Chris Hamiltona46b15442020-07-31 14:38:5651import "third_party/blink/public/mojom/tokens/tokens.mojom";
Daniel Chengd1b775552021-02-19 18:50:0252import "third_party/blink/public/mojom/webpreferences/web_preferences.mojom";
Dave Tapuska9a31f412020-07-20 17:01:2853import "third_party/blink/public/mojom/widget/visual_properties.mojom";
Julie Jeongeun Kim42a90df2019-03-20 23:13:1054import "third_party/blink/public/mojom/window_features/window_features.mojom";
Mario Sanchez Prada5d7f1ac2020-07-16 17:18:4055import "ui/accessibility/mojom/ax_tree_update.mojom";
Julie Jeongeun Kim2b1d45a2019-06-28 23:37:5456import "ui/base/mojom/window_open_disposition.mojom";
Miyoung Shin87943f502019-07-26 13:31:5857import "ui/gfx/geometry/mojom/geometry.mojom";
Kevin McNeeea7f3b82020-02-27 21:42:3258import "url/mojom/origin.mojom";
59import "url/mojom/url.mojom";
ben76f52b242016-06-18 05:42:4860
Miyoung Shin5d77f72072020-10-09 15:14:2061[Native]
62struct PageState;
63
Daniel Chengd1b775552021-02-19 18:50:0264// A View (i.e. a "main frame") can be created for a few different cases, these
65// values are used to specify which it is.
66enum ViewWidgetType {
67 // A standard view that's the top-level widget in a frame hierarchy.
68 kTopLevel,
69 // A GuestView used to render contents inside a <webview> element.
70 kGuestView,
71 // A view used to render contents inside a <portal> element.
72 kPortal
73};
74
75struct CreateViewParams {
76 // Renderer-wide preferences.
77 blink.mojom.RendererPreferences renderer_preferences;
78
79 // Preferences for this view.
80 blink.mojom.WebPreferences web_preferences;
81
82 // The ID of the view to be created.
83 int32 view_id = IPC.mojom.kRoutingIdNone;
84
85 // The session storage namespace ID this view should use.
86 string session_storage_namespace_id;
87
88 // The frame token of the opener frame if one exists, or base::nullopt
89 // otherwise.
Chris Hamilton2ea20312021-02-24 17:20:1490 blink.mojom.FrameToken? opener_frame_token;
Daniel Chengd1b775552021-02-19 18:50:0291
Daniel Cheng4daa51222021-02-21 07:20:1192 // Information that needs to be replicated to the view's main frame, e.g.
93 // frame name and sandbox flags.
94 FrameReplicationState replication_state;
95
96 // Used for devtools instrumentation and trace-ability. The token is shared
97 // across all frames (local or remotes) representing the same logical frame
98 // tree node, and is used by Blink and content to tag calls and requests for
99 // instrumentation purposes, allowing them to be attributed to a context
100 // frame.
101 //
102 // Must not be used to look up a RenderFrameHostImpl or RenderFrameProxyHost
103 // in the browser process, as the token is shared, making the mapping
104 // ambiguous and non-authoritative.
105 mojo_base.mojom.UnguessableToken devtools_main_frame_token;
106
Daniel Chengd1b775552021-02-19 18:50:02107 CreateMainFrameUnion main_frame;
108
109 // Whether the RenderView should initially be hidden.
110 bool hidden;
111
112 // When true, all RenderWidgets under this RenderView will never be shown to
113 // the user, and thus never composited, and will not need to produce pixels
114 // for display. This allows the renderer to optimize and avoid resources used
115 // for displaying graphical output.
116 bool never_composited;
117
118 // Whether the window associated with this view was created with an opener.
119 bool window_was_created_with_opener;
120
121 // Whether lookup of frames in the created RenderView (e.g. lookup via
122 // window.open or via <a target=...>) should be renderer-wide (i.e. going
123 // beyond the usual opener-relationship-based BrowsingInstance boundaries).
124 bool renderer_wide_named_frame_lookup;
125
126 // Indicates whether the view is a regular top-level widget or some other
127 // nested "main frame" widget type.
128 ViewWidgetType type;
129
130 // Endpoint for any messages that are broadcast to all views in a WebContents.
131 pending_associated_receiver<blink.mojom.PageBroadcast> blink_page_broadcast;
132};
133
Daniel Chengd1b775552021-02-19 18:50:02134// A union to distinguish between parameters specific to local main frame
135// creation and remote main frame creation.
136union CreateMainFrameUnion {
137 CreateLocalMainFrameParams local_params;
138 CreateRemoteMainFrameParams remote_params;
139};
140
141// Parameters used for browser-initiated local main frame creation.
142struct CreateLocalMainFrameParams {
Daniel Cheng4daa51222021-02-21 07:20:11143 // The frame token. Used to map between LocalFrame and RenderFrameHostImpl.
144 blink.mojom.LocalFrameToken token;
145
Daniel Chengd1b775552021-02-19 18:50:02146 // The ID of the main frame hosted in the view. Must not be kRoutingIdNone.
147 int32 routing_id = IPC.mojom.kRoutingIdNone;
148
149 // The communication interfaces for the WebLocalFrame in blink.
150 pending_associated_receiver<content.mojom.Frame> frame;
151
152 pending_remote<blink.mojom.BrowserInterfaceBroker> interface_broker;
153
154 // Whether or not the frame has previously committed a real load.
155 bool has_committed_real_load;
156
157 // Null when the main frame has no policy container yet (for example, because
158 // it is a speculative RenderFrameHost), and the policy container will be
159 // sent during CommitNavigation.
160 blink.mojom.PolicyContainer? policy_container;
161
162 CreateFrameWidgetParams widget_params;
163};
164
165// Parameters used for brower-initiated remote main frame creation.
166struct CreateRemoteMainFrameParams {
Daniel Cheng4daa51222021-02-21 07:20:11167 blink.mojom.RemoteFrameToken token;
168
Daniel Chengd1b775552021-02-19 18:50:02169 // The ID of the proxy object for the main frame in this view. Must not be
170 // kRoutingIdNone.
171 int32 routing_id = IPC.mojom.kRoutingIdNone;
172};
173
174// Parameters used for creating a new frame widget.
175struct CreateFrameWidgetParams {
176 // Gives the routing ID for the RenderWidget that will be attached to the
177 // new RenderFrame.
178 int32 routing_id;
179
180 // The communication interfaces for the WebFrameWidget in blink.
181 pending_associated_remote<blink.mojom.FrameWidgetHost> frame_widget_host;
182 pending_associated_receiver<blink.mojom.FrameWidget> frame_widget;
183 pending_associated_remote<blink.mojom.WidgetHost> widget_host;
184 pending_associated_receiver<blink.mojom.Widget> widget;
185
186 // The initial visual properties of the widget.
187 blink.mojom.VisualProperties visual_properties;
188};
189
190// Used for recreating child frames after a crash (does this still happen?) and
191// speculative/provisional frames (including main frame).
192//
193// "Normal" child frame creation (via inserting a new frame owner element into
194// the active document) does not use these params and is routed via
195// CreateChildFrame().
196//
197// "Normal" main frame creation (whether browser-initiated, e.g. opening a new
198// tab, or renderer-initiated, e.g. window.open()) also do not use these params
199// and are routed via CreateView() and CreateNewWindow() respectively.
200//
Daniel Chengd1b775552021-02-19 18:50:02201struct CreateFrameParams {
Daniel Cheng4daa51222021-02-21 07:20:11202 // The frame token. Used to map between LocalFrame and RenderFrameHostImpl.
203 blink.mojom.LocalFrameToken token;
204
Daniel Chengd1b775552021-02-19 18:50:02205 // Specifies the routing ID of the new RenderFrame object.
206 int32 routing_id;
207
208 // If a valid |previous_routing_id| is provided, the new frame will be
209 // configured to replace either the previous frame or the previous proxy on
210 // commit.
211 int32 previous_routing_id;
212
Daniel Chengd1b775552021-02-19 18:50:02213 // Specifies the new frame's opener. The opener will be null if this is
214 // base::nullopt.
Chris Hamilton2ea20312021-02-24 17:20:14215 blink.mojom.FrameToken? opener_frame_token;
Daniel Chengd1b775552021-02-19 18:50:02216
217 // The new frame should be created as a child of the object
218 // identified by |parent_routing_id| or as top level if that is
219 // MSG_ROUTING_NONE.
220 int32 parent_routing_id;
221
222 // Identifies the previous sibling of the new frame, so that the new frame is
223 // inserted into the correct place in the frame tree. If this is
224 // MSG_ROUTING_NONE, the frame will be created as the leftmost child of its
225 // parent frame, in front of any other children.
226 int32 previous_sibling_routing_id;
227
228 pending_remote<blink.mojom.BrowserInterfaceBroker> interface_broker;
229
230 // When the new frame has a parent, |replication_state| holds the new frame's
231 // properties replicated from the process rendering the parent frame, such as
232 // the new frame's sandbox flags.
233 FrameReplicationState replication_state;
234
235 // Used for devtools instrumentation and trace-ability. The token is
236 // propagated to Blink's LocalFrame and both Blink and content/
237 // can tag calls and requests with this instrumentation token in order to
238 // attribute them to the context frame.
239 // |devtools_frame_token| is only defined by the browser and is never
240 // sent back from the renderer in the control calls.
241 mojo_base.mojom.UnguessableToken devtools_frame_token;
242
243 // When the new frame has a parent, |frame_owner_properties| holds the
244 // properties of the HTMLFrameOwnerElement from the parent process.
245 // Note that unlike FrameReplicationState, this is not replicated for remote
246 // frames.
247 blink.mojom.FrameOwnerProperties frame_owner_properties;
248
249 // Specifies properties for a new RenderWidget that will be attached to the
250 // new RenderFrame (if one is needed).
251 CreateFrameWidgetParams? widget_params;
252
253 // Whether or not the frame has previously committed a real load.
254 bool has_committed_real_load;
255
256 // The policy container for the frame to be created. This can be null if we
257 // could not determine a policy container yet, for example in case of a
258 // speculative RenderFrameHost. In that case, the final policy container will
259 // be sent along CommitNavigation.
260 blink.mojom.PolicyContainer? policy_container;
261
262 // The mojo connection to the mojom::Frame in the renderer.
263 pending_associated_receiver<content.mojom.Frame> frame;
264};
265
Mario Sanchez Prada13bbad52020-06-01 18:12:29266// Provided with each call to Frame::GetSerializedHtmlWithLocalLinks() so that
267// the renderer can notify the browser process each time that a chunk of HTML
268// data gets serialized, as well as when the entire process is finished.
269interface FrameHTMLSerializerHandler {
270 // Sent by the renderer as a response to GetSerializedHtmlWithLocalLinks() to
271 // indicate that HTML data has been serialized, included in |data_buffer|.
272 DidReceiveData(string data_buffer);
273
274 // Reports that the serialization process is finished. It is expected to
275 // receive this message right after the last time DidReceiveData() is called.
276 Done();
277};
278
Dominic Mazzoni77d0aba2021-01-14 09:42:16279struct SnapshotAccessibilityTreeParams {
280 // See ui/accessibility/ax_mode.h for valid values of |ax_mode|.
281 uint32 ax_mode;
282
283 // If true, nodes that are entirely offscreen will have their entire
284 // subtree excluded. Note that this heuristic is imperfect, and
285 // an absolute-positioned node that's visible, but whose ancestors
286 // are entirely offscreen, may get excluded.
287 bool exclude_offscreen;
288
289 // The maximum number of nodes to snapshot before exiting early.
290 // Note that this is not a hard limit; once this limit is reached a
291 // few more nodes may be added in order to ensure a well-formed
292 // tree is returned. Use 0 for no max. The corresponding C++ code
293 // uses size_t.
294 uint64 max_nodes;
295
296 // The maximum amount of time to spend snapshotting the tree. Like
297 // max_nodes, this is not a hard limit, and once this limit is reached
298 // a few more nodes may be added in order to ensure a well-formed tree.
299 // Use 0 for no timeout.
300 mojo_base.mojom.TimeDelta timeout;
301};
302
Dave Tapuska795de45a2021-01-12 20:48:05303// An enumeration specifying the reason of the frame deletion.
304enum FrameDeleteIntention {
305 // The frame being deleted isn't a (speculative) main frame.
306 kNotMainFrame,
307 // The frame being deleted is a speculative main frame, and it is being
308 // deleted as part of the shutdown for that WebContents. The entire RenderView
309 // etc will be destroyed by a separate IPC sent later.
310 kSpeculativeMainFrameForShutdown,
311 // The frame being deleted is a speculative main frame, and it is being
312 // deleted because the speculative navigation was cancelled. This is not part
313 // of shutdown.
314 kSpeculativeMainFrameForNavigationCancelled,
315};
316
danakj0bdfacd2021-01-20 19:27:18317// Implemented by the frame provider, and must be associated with other content
318// mojoms bound to frames, widgets, views, and currently also with the legacy
319// IPC channel.
Arthur Hemeryd3011f62018-05-30 10:38:44320// KEEP THE COMMIT FUNCTIONS IN SYNC in content/common/navigation_client.mojom.
danakj0bdfacd2021-01-20 19:27:18321// These will eventually be removed from Frame.
322interface Frame {
clamyaf4bf2d92018-02-06 10:54:36323 // Tells the renderer that a same-document navigation should be committed.
324 // The renderer will return a status value indicating whether the commit
325 // could proceed as expected or not. In particular, it might be necessary to
326 // restart the navigation if it is no-longer same-document, which can happen
327 // if the renderer committed another navigation in the meantime.
328 CommitSameDocumentNavigation(
329 CommonNavigationParams common_params,
Nasko Oskovc36327d2019-01-03 23:23:04330 CommitNavigationParams request_params)
clamyaf4bf2d92018-02-06 10:54:36331 => (blink.mojom.CommitResult commit_result);
332
clamyb1df7b962018-02-01 17:38:17333 // Asks the renderer to handle a renderer-debug URL.
334 HandleRendererDebugURL(url.mojom.Url url);
335
Chong Zhang7306b0b2018-01-24 05:59:24336 // Provides the renderer an updated |subresource_loader_factories|.
337 //
338 // This method is intended to fix broken loaders after a Network Service
339 // crash, and is only used when Network Service is enabled.
340 //
341 // The new bundle contains replacement factories for a subset of the
342 // receiver's existing bundle.
343 UpdateSubresourceLoaderFactories(
Hiroki Nakagawa753758342018-12-27 04:13:49344 blink.mojom.URLLoaderFactoryBundle subresource_loader_factories);
Dmitry Gozman6adf95b2018-10-10 22:12:19345
346 // Returns a DevToolsAgent interface for this frame, used for
347 // remote debugging. See DevToolsAgent for details.
348 // Returned DevToolsAgent must be associated with navigation control,
349 // due to various ordering dependencies between DevTools protocol and
350 // navigation.
Julie Jeongeun Kim07887792019-08-13 11:05:48351 BindDevToolsAgent(
352 pending_associated_remote<blink.mojom.DevToolsAgentHost> agent_host,
Andrey Kosyakov5bb020f2020-03-19 17:28:19353 pending_associated_receiver<blink.mojom.DevToolsAgent> agent);
Hajime Hoshi35ad74f2019-03-07 08:38:05354
Maksim Sadymcfb8f8d2020-09-30 20:30:45355 // Request for the renderer to execute a given JavaScript method on a given
356 // object (both identified by name) in the frame's context.
357 //
358 // |object_name| is the global name of the object.
359 //
360 // |method_name| is the name of the method on the object.
361 //
362 // |arguments| is the list of arguments to pass to the method invocation.
363 //
364 // |wants_result| is true if the result of this execution is required by the
365 // caller. If it is false, a reply is still required by Mojo, but a null value
366 // should be returned to avoid issues serializing a large, unwanted reply.
367 JavaScriptMethodExecuteRequest(
368 mojo_base.mojom.String16 object_name,
369 mojo_base.mojom.String16 method_name,
370 mojo_base.mojom.ListValue arguments,
371 bool wants_result) => (mojo_base.mojom.Value result);
372
Hajime Hoshi35ad74f2019-03-07 08:38:05373 // Request for the renderer to execute JavaScript in the frame's context.
374 //
375 // |javascript| is the string containing the JavaScript to be executed in the
Avi Drissman90630d92020-04-29 21:17:36376 // target frame's context. Note that this uses BigString16 rather than
377 // String16 as this is used in contexts, like DevTools, where the contents of
378 // the JavaScript script is user-provided, and therefore we can't guarantee
379 // the size of the script.
Hajime Hoshi35ad74f2019-03-07 08:38:05380 //
Avi Drissman8e3ebe92019-06-10 20:26:11381 // |wants_result| is true if the result of this execution is required by the
382 // caller. If it is false, a reply is still required by Mojo, but a null value
383 // should be returned to avoid issues serializing a large, unwanted reply.
384 //
Hajime Hoshi35ad74f2019-03-07 08:38:05385 // TODO(hajimehoshi): This requires navigate association to keep the message
386 // order with other navigation-related messages. Fix this and move this to a
387 // non-navigate-related interface if possible.
Avi Drissman4544828f2019-03-11 20:37:32388 JavaScriptExecuteRequest(
Avi Drissman90630d92020-04-29 21:17:36389 mojo_base.mojom.BigString16 javascript,
Avi Drissman8e3ebe92019-06-10 20:26:11390 bool wants_result) => (mojo_base.mojom.Value result);
Hajime Hoshi35ad74f2019-03-07 08:38:05391
Mustaq Ahmed02cd8832019-12-05 15:46:56392 // ONLY FOR TESTS: Same as above but this can optionally trigger a fake user
393 // activation notification to test functionalities that are gated by user
394 // activation.
Avi Drissman4544828f2019-03-11 20:37:32395 JavaScriptExecuteRequestForTests(
Avi Drissman90630d92020-04-29 21:17:36396 mojo_base.mojom.BigString16 javascript,
Avi Drissman8e3ebe92019-06-10 20:26:11397 bool wants_result,
Hajime Hoshif85e7cf722019-07-19 00:54:49398 bool has_user_gesture,
399 int32 world_id)
Avi Drissman4544828f2019-03-11 20:37:32400 => (mojo_base.mojom.Value result);
Hajime Hoshi35ad74f2019-03-07 08:38:05401
402 // Same as JavaScriptExecuteRequest above except the script is run in the
403 // isolated world specified by the fourth parameter.
Avi Drissman4544828f2019-03-11 20:37:32404 JavaScriptExecuteRequestInIsolatedWorld(
Avi Drissman90630d92020-04-29 21:17:36405 mojo_base.mojom.BigString16 javascript,
Avi Drissman8e3ebe92019-06-10 20:26:11406 bool wants_result,
Avi Drissman4544828f2019-03-11 20:37:32407 int32 world_id) => (mojo_base.mojom.Value result);
Yuzu Saijoaae91702019-03-13 07:38:05408
Ian Barkley-Yeungbda77fb2020-12-08 04:26:46409 // Indicates that the frame host (browser) wants the |untrusted_stack_trace|
410 // parameter of DidAddMessageToConsole() filled in for Error messages if at
411 // all possible.
412 SetWantErrorMessageStackTrace();
413
Dave Tapuskaca250702021-01-07 17:40:55414 // Unload this RenderFrame and replace it by a RenderFrameProxy, so the frame
415 // can navigate to a document rendered by a different process. The unload can
416 // fail if the RenderFrame is currently detached (it was removed from the
417 // frame tree before the Unload was received). If successful this message will
418 // send back AgentSchedulingGroupHost::DidUnloadRenderFrame message. This
419 // cannot be a standard reply callback because the unload acknowledgement must
420 // be posted back to the event loop to be invoked later. This is to ensure
421 // that any postMessage() calls executed by JS during unload are dispatched,
422 // since postMessage dispatch is always scheduled asynchronously.
423 Unload(int32 new_remote_frame_routing_id,
424 bool is_loading,
425 FrameReplicationState new_remote_frame_replication_state,
Chris Hamilton6c60a832021-02-19 20:35:46426 blink.mojom.RemoteFrameToken new_remote_frame_token);
Dave Tapuska795de45a2021-01-12 20:48:05427
428 // Delete the frame. This is only called for child frames that the browser
429 // wants to detach, or for speculative main frames which are owned by the
430 // browser process. Committed main frames are owned by the renderer's WebView
431 // and can not be deleted directly.
432 Delete(FrameDeleteIntention intention);
danakj0bdfacd2021-01-20 19:27:18433
434 // Causes all new subresource requests to be blocked (not being started) until
435 // ResumeBlockedRequests is called.
436 BlockRequests();
437
438 // Resumes blocked requests.
439 // It is safe to call this without calling BlockRequests.
440 ResumeBlockedRequests();
441
442 GetInterfaceProvider(
443 pending_receiver<service_manager.mojom.InterfaceProvider> interfaces);
444
445 GetCanonicalUrlForSharing() => (url.mojom.Url? canonical_url);
446
447 // Samsung Galaxy Note-specific "smart clip" stylus text getter.
448 // Extracts the data at the given rect.
449 [EnableIf=is_android]
450 ExtractSmartClipData(gfx.mojom.Rect rect)
451 => (mojo_base.mojom.String16 text, mojo_base.mojom.String16 html,
452 gfx.mojom.Rect clip_rect);
453
454 // Requests a one-time snapshot of the accessibility tree without enabling
455 // accessibility if it wasn't already enabled.
456 SnapshotAccessibilityTree(SnapshotAccessibilityTreeParams params)
457 => (ax.mojom.AXTreeUpdate snapshot);
458
459 // Get HTML data by serializing the target frame and replacing all resource
460 // links with a path to the local copy passed in the message payload. In order
461 // to report progress to the the browser process, a pending remote is passed
462 // via |callback_remote|, so that direct communication with the SavePackage
463 // object that initiated the process can be established.
464 GetSerializedHtmlWithLocalLinks(
465 map<url.mojom.Url, mojo_base.mojom.FilePath> url_map,
Chris Hamilton2ea20312021-02-24 17:20:14466 map<blink.mojom.FrameToken, mojo_base.mojom.FilePath>
danakj0bdfacd2021-01-20 19:27:18467 frame_token_map, bool save_with_empty_url,
468 pending_remote<FrameHTMLSerializerHandler> handler_remote);
Ken Rockot48785452017-10-25 19:33:14469};
470
sammc7f6c6a02017-01-30 00:53:51471// Implemented by the frame (e.g. renderer processes).
472// Instances of this interface must be associated with (i.e., FIFO with) the
473// legacy IPC channel.
474interface FrameBindingsControl {
475 // Used to tell a render frame whether it should expose various bindings
476 // that allow JS content extended privileges. See BindingsPolicy for valid
477 // flag values.
478 AllowBindings(int32 enabled_bindings_flags);
Nasko Oskov8a73f7d2019-09-27 22:29:32479
480 // Used to tell the RenderFrame to enable Mojo JS bindings, which allows
481 // JS code running in the renderer process to connect to Mojo interfaces
482 // and make method calls on them.
483 // This is used for WebUI only at this time.
484 EnableMojoJsBindings();
Miyoung Shin072d4052020-07-13 07:52:44485
486 // Used to bind WebUI and WebUIHost mojo connections.
Daniel Cheng4b931a4f2020-12-18 01:59:35487 BindWebUI(pending_associated_receiver<content.mojom.WebUI> receiver,
488 pending_associated_remote<content.mojom.WebUIHost> remote);
sammc7f6c6a02017-01-30 00:53:51489};
490
csharrison95f01e922017-04-24 18:52:35491struct CreateNewWindowParams {
Mustaq Ahmed8601a562020-01-31 18:05:52492 // True if ContentRendererClient allows popups. This is the case only for
493 // extensions.
494 bool allow_popup;
csharrison95f01e922017-04-24 18:52:35495
496 // Type of window requested.
497 WindowContainerType window_container_type;
498
499 // The session storage namespace ID this window should use.
Daniel Murphy31bbb8b12018-02-07 21:44:10500 string session_storage_namespace_id;
csharrison95f01e922017-04-24 18:52:35501
Daniel Murphye3eec92c2018-02-23 19:09:15502 // The session storage namespace ID this window should clone from.
503 // TODO(dmurph): Remove this once session storage is fully mojo'd, as the
504 // clone call happens on a different interface. https://crbug.com/716490
505 string clone_from_session_storage_namespace_id;
506
csharrison95f01e922017-04-24 18:52:35507 // The name of the resulting frame that should be created (empty if none
508 // has been specified). UTF8 encoded string.
509 string frame_name;
510
csharrison95f01e922017-04-24 18:52:35511 // Whether the opener will be suppressed in the new window, in which case
512 // scripting the new window is not allowed.
513 bool opener_suppressed;
514
515 // Whether the window should be opened in the foreground, background, etc.
516 ui.mojom.WindowOpenDisposition disposition;
517
518 // The URL that will be loaded in the new window (empty if none has been
519 // specified).
520 url.mojom.Url target_url;
521
522 // The referrer that will be used to load |target_url| (empty if none has
523 // been specified).
524 blink.mojom.Referrer referrer;
525
526 // The window features to use for the new window.
527 blink.mojom.WindowFeatures features;
John Delaney8623c642021-01-06 17:37:07528
529 // The impression associated with the navigation in the new window, if
530 // one is specified.
531 Impression? impression;
csharrison95f01e922017-04-24 18:52:35532};
533
Daniel Cheng8bb30c62017-10-23 20:40:47534// Operation result when the renderer asks the browser to create a new window.
535enum CreateNewWindowStatus {
536 // Ignore creation of the new window. This can happen because creation is
537 // blocked or because the new window should have no opener relationship.
538 kIgnore,
539 // Reuse the current window rather than creating a new window.
540 kReuse,
541 // Create a new window using the corresponding params in |reply|.
542 kSuccess,
543};
544
545// All routing IDs in this struct must be set to a valid routing ID.
Daniel Cheng4daa51222021-02-21 07:20:11546// TODO(dcheng): It's almost possible to use CreateLocalMainFrameParams here.
547// See if there's a reasonable way to factor out state here by splitting things
548// into browser-created params vs renderer-created params.
csharrison95f01e922017-04-24 18:52:35549struct CreateNewWindowReply {
Daniel Cheng8bb30c62017-10-23 20:40:47550 // The ID of the view to be created.
csharrison95f01e922017-04-24 18:52:35551 int32 route_id;
552
Daniel Cheng4daa51222021-02-21 07:20:11553 // The unique identifier of the RenderFrameHost
554 blink.mojom.LocalFrameToken main_frame_token;
555
csharrison95f01e922017-04-24 18:52:35556 // The ID of the main frame hosted in the view.
557 int32 main_frame_route_id;
558
danakj0bdfacd2021-01-20 19:27:18559 // The pending mojo connection to the Frame implementation in the renderer.
560 pending_associated_receiver<content.mojom.Frame> frame;
561
Daniel Chengd1b775552021-02-19 18:50:02562 CreateFrameWidgetParams widget_params;
Dave Tapuska8499eec2020-03-16 17:54:30563
Yuzu Saijod46f498a2020-08-04 02:56:22564 // The communication interfaces for the PageBroadcast.
565 pending_associated_receiver<blink.mojom.PageBroadcast> page_broadcast;
566
Ken Rockotc4a0ada92020-12-02 00:22:14567 pending_remote<blink.mojom.BrowserInterfaceBroker>
568 main_frame_interface_broker;
Balazs Engedyba034e72017-10-27 22:26:28569
csharrison95f01e922017-04-24 18:52:35570 // Duplicated from CreateNewWindowParams because legacy code.
Daniel Murphy31bbb8b12018-02-07 21:44:10571 string cloned_session_storage_namespace_id;
Pavel Feldman08beed7842017-10-17 19:18:11572
Daniel Cheng4daa51222021-02-21 07:20:11573 // Used for devtools instrumentation and trace-ability. The token is shared
574 // across all frames (local or remotes) representing the same logical frame
575 // tree node, and is used by Blink and content to tag calls and requests for
576 // instrumentation purposes, allowing them to be attributed to a context
577 // frame.
578 //
579 // Must not be used to look up a RenderFrameHostImpl or RenderFrameProxyHost
580 // in the browser process, as the token is shared, making the mapping
581 // ambiguous and non-authoritative.
Oksana Zhuravlova34579e912018-03-23 00:18:49582 mojo_base.mojom.UnguessableToken devtools_main_frame_token;
Yury Semikhatsky82730ff2020-02-25 22:29:26583
584 // Used by devtools instrumentation to tell devtools agent in the renderer
585 // that it should pause created window and wait for an explicit resume command
586 // from the client.
587 bool wait_for_debugger;
Antonio Sartori7f809cc72020-10-30 07:47:20588
589 // The policy container for the new frame that will be created by Blink in
590 // response.
Antonio Sartori9290b6b2020-11-09 10:09:33591 blink.mojom.PolicyContainer policy_container;
csharrison95f01e922017-04-24 18:52:35592};
593
csharrison95f01e922017-04-24 18:52:35594// Implemented by the frame server (i.e. the browser process). For messages that
595// must be associated with the IPC channel.
596interface FrameHost {
Daniel Cheng8bb30c62017-10-23 20:40:47597 // Sent by the renderer to request the browser to create a new window. |reply|
598 // is only non-null on when status == CreateNewWindowStatus::kSuccess.
csharrison95f01e922017-04-24 18:52:35599 [Sync] CreateNewWindow(CreateNewWindowParams params)
Daniel Cheng8bb30c62017-10-23 20:40:47600 => (CreateNewWindowStatus status, CreateNewWindowReply? reply);
Yutaka Hiranof7f2f632017-09-06 10:40:08601
Lucas Furukawa Gadani99125822019-01-03 15:41:49602 // Sent by the renderer process to request the creation of a new portal.
Adithya Srinivasane8bf80e2019-05-01 15:39:31603 // |portal| is the pipe to be used for the Portal object, |client| is the pipe
Dave Tapuska84449382020-05-01 00:39:04604 // used to communicate back with the caller. Returns:
605 // |proxy_routing_id| - the routing id of the RenderFrameProxy
606 // |initial_replicated_state| - the replicated state associated with that
607 // RenderFrameProxy
608 // |portal_token| - the unique identifier for the portal
609 // |frame_token| - the unique identifier of the RenderFrameProxy
610 // |devtools_frame_token| - the unique identifier of the frame node in the
611 // frame tree
Jeremy Romand92e1372019-06-04 16:31:17612 [Sync] CreatePortal(
613 pending_associated_receiver<blink.mojom.Portal> portal,
614 pending_associated_remote<blink.mojom.PortalClient> client)
Lucas Furukawa Gadani99125822019-01-03 15:41:49615 => (int32 proxy_routing_id,
Kevin McNee51ef5dc2020-01-13 17:52:37616 FrameReplicationState initial_replicated_state,
Adithya Srinivasanea4760c2020-07-30 15:44:57617 blink.mojom.PortalToken portal_token,
Chris Hamilton6c60a832021-02-19 20:35:46618 blink.mojom.RemoteFrameToken frame_token,
Lucas Furukawa Gadanif68204d2019-04-30 17:30:24619 mojo_base.mojom.UnguessableToken devtools_frame_token);
Lucas Furukawa Gadani99125822019-01-03 15:41:49620
Lucas Furukawa Gadani56dd5452019-03-22 18:23:12621 // Requests that this frame adopts the portal identified by |portal_token|.
Dave Tapuska84449382020-05-01 00:39:04622 // Returns:
623 // |proxy_routing_id| - the routing id of the portal's RenderFrameProxy
624 // |replicated_state| - the replicated state associated with that
625 // RenderFrameProxy
626 // |frame_token| - the unique identifier of the RenderFrameProxy
627 // |devtools_frame_token| - the unique identifier of the frame node in the
628 // frame tree
Adithya Srinivasanea4760c2020-07-30 15:44:57629 [Sync] AdoptPortal(blink.mojom.PortalToken portal_token)
Lucas Furukawa Gadanif68204d2019-04-30 17:30:24630 => (int32 proxy_routing_id,
Jeremy Roman62fee222019-07-09 17:34:14631 FrameReplicationState replicated_state,
Chris Hamilton6c60a832021-02-19 20:35:46632 blink.mojom.RemoteFrameToken frame_token,
Lucas Furukawa Gadanif68204d2019-04-30 17:30:24633 mojo_base.mojom.UnguessableToken devtools_frame_token);
Lucas Furukawa Gadani56dd5452019-03-22 18:23:12634
Dave Tapuskad9835622020-03-10 17:32:31635
636 // Similar to CreateNewWindow, except used for sub-widgets, like <select>
Dave Tapuska04ccda062020-10-21 21:58:12637 // dropdowns. Upon return, the renderer side popup will be owned by the
638 // PopupWidgetHost.
Dave Tapuskad95cfb32020-11-02 17:04:55639 CreateNewPopupWidget(
Dave Tapuska04ccda062020-10-21 21:58:12640 pending_associated_receiver<blink.mojom.PopupWidgetHost> popup_host,
Dave Tapuska8499eec2020-03-16 17:54:30641 pending_associated_receiver<blink.mojom.WidgetHost> blink_widget_host,
Dave Tapuskad95cfb32020-11-02 17:04:55642 pending_associated_remote<blink.mojom.Widget> blink_widget);
Dave Tapuskad9835622020-03-10 17:32:31643
Dave Tapuska4e60c232020-11-05 15:49:32644 // Asynchronously creates a child frame. A routing ID must be allocated first
645 // by calling RenderMessageFilter::GenerateFrameRoutingID()
646 // Each of these messages will have a corresponding mojom::FrameHost::Detach
647 // API sent when the frame is detached from the DOM.
648 CreateChildFrame(int32 child_routing_id,
danakj0bdfacd2021-01-20 19:27:18649 pending_associated_remote<content.mojom.Frame> frame,
Dave Tapuska4e60c232020-11-05 15:49:32650 pending_receiver<blink.mojom.BrowserInterfaceBroker>
651 browser_interface_broker,
Antonio Sartoridb967c52021-01-20 09:54:30652 blink.mojom.PolicyContainerBindParams
653 policy_container_bind_params,
Dave Tapuska4e60c232020-11-05 15:49:32654 blink.mojom.TreeScopeType scope,
655 string frame_name,
656 string frame_unique_name,
657 bool is_created_by_script,
658 blink.mojom.FramePolicy frame_policy,
659 blink.mojom.FrameOwnerProperties frame_owner_properties,
660 blink.mojom.FrameOwnerElementType frame_owner_element_type);
661
Balazs Engedya40712f2017-09-15 15:01:11662 // Sent by the renderer when a navigation commits in the frame.
Oksana Zhuravlova8b88e572019-01-07 21:54:00663
664 // If |interface_params| is non-empty, the FrameHost implementation
Ken Rockot228182e2020-12-01 18:43:59665 // must unbind the old BrowserInterfaceBroker connections, and drop any
666 // interface requests pending on them. Then it should bind the appropriate
667 // requests and start servicing GetInterface messages coming in on these new
668 // connections in a security context that is appropriate for the committed
669 // navigation.
Balazs Engedy0c8d550b2017-12-06 21:30:23670 //
Oksana Zhuravlova8b88e572019-01-07 21:54:00671 // The FrameHost implementation must enforce that |interface_params|
Balazs Engedy0c8d550b2017-12-06 21:30:23672 // is set for cross-document navigations. This prevents origin confusion by
673 // ensuring that interface requests racing with navigation commit will be
674 // either ignored, or serviced correctly in the security context of the
Ken Rockot228182e2020-12-01 18:43:59675 // document they originated from (based on which BrowserInterfaceBroker
676 // connection the GetInterface messages arrive on).
Balazs Engedya40712f2017-09-15 15:01:11677 DidCommitProvisionalLoad(
Balazs Engedy0c8d550b2017-12-06 21:30:23678 DidCommitProvisionalLoadParams params,
Oksana Zhuravlova8b88e572019-01-07 21:54:00679 DidCommitProvisionalLoadInterfaceParams? interface_params);
Arthur Hemery7b67a972017-12-01 15:24:49680
Arthur Hemery7b0ae492018-02-05 16:04:45681 // Sent by the renderer to indicate that a same document navigation
682 // committed in the renderer process.
683 DidCommitSameDocumentNavigation(
Rakina Zata Amni26357782020-12-03 11:45:01684 DidCommitProvisionalLoadParams params,
685 DidCommitSameDocumentNavigationParams same_document_params);
Arthur Hemery7b0ae492018-02-05 16:04:45686
Arthur Hemery7b67a972017-12-01 15:24:49687 // Sent by the renderer to request a navigation.
Marijn Kruisselbrink07bf59d52018-04-03 21:50:25688 // |blob_url_token| should be non-null when this is a navigation to a blob:
689 // URL. The token will then be used to look up the blob associated with the
690 // blob URL. Without this by the time the navigation code starts fetching
691 // the URL the blob URL might no longer be valid. |blob_url_token| is
692 // not part of BeginNavigationParams because that struct needs to be
693 // cloneable, and thus can't contain mojo interfaces.
694 // If an invalid BlobURLToken is passed in, or if the token doesn't match the
695 // url in |common_params|, the navigation will result in a network error.
Arthur Hemeryd3011f62018-05-30 10:38:44696 // |navigation_client| is passed to the renderer to allow for further control
Nasko Oskovd22f9bf872020-12-23 00:31:35697 // of the navigation. Allows for Commit and Cancels/Aborts.
Antonio Sartoridb967c52021-01-20 09:54:30698 // Passing the |initiator_policy_container_keep_alive_handle| is just a means
699 // to ensure that the PolicyContainerHost of the initiator RenderFrameHost is
700 // kept alive, even if the RenderFrameHost itself has already been deleted in
701 // the meantime. If this can be ensured in other ways, it is safe to pass a
702 // mojo::NullRemote. In particular, if the initiator LocalFrame is alive when
703 // issuing this mojo call, there is no need to pass
704 // |initiator_policy_container_keep_alive_handle|, since the initiator
705 // PolicyContainerHost is kept alive by LocalFrame's PolicyContainer.
Arthur Hemeryd3011f62018-05-30 10:38:44706 // TODO(ahemery): |navigation_client| should not be optional. Make it
Nasko Oskovd22f9bf872020-12-23 00:31:35707 // mandatory.
Arthur Hemery7b67a972017-12-01 15:24:49708 BeginNavigation(
709 CommonNavigationParams common_params,
Marijn Kruisselbrink07bf59d52018-04-03 21:50:25710 BeginNavigationParams begin_params,
Julie Jeongeun Kim249cfbb2019-08-30 06:44:05711 pending_remote<blink.mojom.BlobURLToken>? blob_url_token,
Julie Jeongeun Kimed2e5ba72019-09-12 10:14:17712 pending_associated_remote<NavigationClient>? navigation_client,
Antonio Sartoridb967c52021-01-20 09:54:30713 pending_remote<blink.mojom.NavigationInitiator>? navigation_initiator,
714 pending_remote<blink.mojom.PolicyContainerHostKeepAliveHandle>?
715 initiator_policy_container_keep_alive_handle);
John Abd-El-Malekd4882642017-12-04 21:45:19716
717 // Sent when a subresource response has started.
Jay Civellid5904f02018-03-23 19:43:57718 // |cert_status| is the bitmask of status info of the SSL certificate. (see
719 // net/cert/cert_status_flags.h).
Lukasz Anforowiczd334bba2020-02-10 23:32:55720 SubresourceResponseStarted(url.mojom.Url url, uint32 cert_status);
Jay Civellid5904f02018-03-23 19:43:57721
Jay Civelli116683f2018-03-27 19:56:23722 // Sent when a resource load finished, successfully or not.
Minggang Wangee5af392020-02-05 02:55:28723 ResourceLoadComplete(blink.mojom.ResourceLoadInfo url_load_info);
Luciano Pacheco8def47f2017-12-07 06:52:30724
725 // Sent when the frame changes its window.name.
726 DidChangeName(string name, string unique_name);
727
Austin Tankiang10d64832017-12-20 02:43:55728 // If a cross-process navigation was started for the initial history load in
729 // this subframe, this tries to cancel it to allow a client redirect to happen
730 // instead.
731 CancelInitialHistoryLoad();
732
733 // Change the encoding name of the page in UI when the page has detected
734 // proper encoding name. Sent for top-level frames.
735 UpdateEncoding(string encoding_name);
Lucas Furukawa Gadanie5d27a362018-02-13 14:26:02736
Clark DuValla0e42992018-09-17 17:00:11737 // Updates information to determine whether a user gesture should carryover to
738 // future navigations. This is needed so navigations within a certain
739 // timeframe of a request initiated by a gesture will be treated as if they
740 // were initiated by a gesture too, otherwise the navigation may be blocked.
741 [EnableIf=is_android]
742 UpdateUserGestureCarryoverInfo();
Lowell Manners9499addc2019-03-12 11:05:32743
Gyuyoung Kimbc7dee642020-06-17 01:43:29744 // Notifies the browser that this frame has new session history information.
Ken Rockot4da6ac02020-10-27 01:28:25745 //
746 // NOTE: PageState can be quite large when serialized, and its message
747 // structure must remain stable; hence [UnlimitedSize] for this message.
748 [UnlimitedSize]
Gyuyoung Kimbc7dee642020-06-17 01:43:29749 UpdateState(PageState state);
Gyuyoung Kim0028790a2020-06-26 00:09:00750
751 // Requests that the given URL be opened in the specified manner.
Yeunjoo Choi9232ea32021-03-08 16:25:17752 OpenURL(blink.mojom.OpenURLParams params);
Gyuyoung Kim847ecc72020-07-21 14:07:55753
754 // Called when the renderer is done loading a frame.
755 DidStopLoading();
ben76f52b242016-06-18 05:42:48756};