blob: 5f6980ca1865dfb58830de7012d7c3f499457e3d [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";
Daniel Chengd1b775552021-02-19 18:50:0214import "ipc/constants.mojom";
Mario Sanchez Prada13bbad52020-06-01 18:12:2915import "mojo/public/mojom/base/file_path.mojom";
Ken Rockot8b447d72018-02-03 20:30:4716import "mojo/public/mojom/base/string16.mojom";
Dominic Mazzoni77d0aba2021-01-14 09:42:1617import "mojo/public/mojom/base/time.mojom";
Oksana Zhuravlova34579e912018-03-23 00:18:4918import "mojo/public/mojom/base/unguessable_token.mojom";
Hajime Hoshi35ad74f2019-03-07 08:38:0519import "mojo/public/mojom/base/values.mojom";
arthursonzogni42eabe012020-01-17 15:55:5620import "services/network/public/mojom/content_security_policy.mojom";
Daniel Chengd1b775552021-02-19 18:50:0221import "services/network/public/mojom/url_loader.mojom";
Dave Tapuska2a6046a2021-03-01 22:42:5222import "services/network/public/mojom/url_loader_factory.mojom";
23import "services/network/public/mojom/url_request.mojom";
arthursonzogni42eabe012020-01-17 15:55:5624import "services/network/public/mojom/url_response_head.mojom";
Ken Rockot543f5e32018-02-04 02:13:5025import "services/service_manager/public/mojom/interface_provider.mojom";
Miyoung Shin99505dd2019-07-27 12:45:3526import "services/viz/public/mojom/compositing/surface_id.mojom";
Blink Reformata30d4232018-04-07 15:31:0627import "third_party/blink/public/mojom/blob/blob_url_store.mojom";
Dave Tapuska4e60c232020-11-05 15:49:3228import "third_party/blink/public/mojom/browser_interface_broker.mojom";
Julie Jeongeun Kim42a90df2019-03-20 23:13:1029import "third_party/blink/public/mojom/commit_result/commit_result.mojom";
Lowell Mannersf03ea5a2019-04-23 11:47:5830import "third_party/blink/public/mojom/devtools/console_message.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";
Gyuyoung Kimc16e52e92021-03-19 02:45:3735import "third_party/blink/public/mojom/frame/frame_replication_state.mojom";
Dave Tapuskad6703f912019-01-31 23:13:1136import "third_party/blink/public/mojom/frame/lifecycle.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";
Daniel Chengd1b775552021-02-19 18:50:0239import "third_party/blink/public/mojom/loader/referrer.mojom";
Minggang Wangee5af392020-02-05 02:55:2840import "third_party/blink/public/mojom/loader/resource_load_info.mojom";
Hiroki Nakagawa753758342018-12-27 04:13:4941import "third_party/blink/public/mojom/loader/url_loader_factory_bundle.mojom";
Yuzu Saijoaae91702019-03-13 07:38:0542import "third_party/blink/public/mojom/messaging/transferable_message.mojom";
Yuzu Saijod46f498a2020-08-04 02:56:2243import "third_party/blink/public/mojom/page/page.mojom";
Dave Tapuska8499eec2020-03-16 17:54:3044import "third_party/blink/public/mojom/page/widget.mojom";
Lucas Furukawa Gadani89a74182019-01-10 19:33:2245import "third_party/blink/public/mojom/portal/portal.mojom";
Daniel Chengd1b775552021-02-19 18:50:0246import "third_party/blink/public/mojom/renderer_preferences.mojom";
Hiroki Nakagawacdbc7912018-11-30 11:30:0547import "third_party/blink/public/mojom/service_worker/controller_service_worker.mojom";
Hiroki Nakagawa077f20962020-05-15 08:04:4448import "third_party/blink/public/mojom/service_worker/service_worker_container.mojom";
Chris Hamiltona46b15442020-07-31 14:38:5649import "third_party/blink/public/mojom/tokens/tokens.mojom";
Daniel Chengd1b775552021-02-19 18:50:0250import "third_party/blink/public/mojom/webpreferences/web_preferences.mojom";
Dave Tapuska9a31f412020-07-20 17:01:2851import "third_party/blink/public/mojom/widget/visual_properties.mojom";
Julie Jeongeun Kim42a90df2019-03-20 23:13:1052import "third_party/blink/public/mojom/window_features/window_features.mojom";
Mario Sanchez Prada5d7f1ac2020-07-16 17:18:4053import "ui/accessibility/mojom/ax_tree_update.mojom";
Julie Jeongeun Kim2b1d45a2019-06-28 23:37:5454import "ui/base/mojom/window_open_disposition.mojom";
Miyoung Shin87943f502019-07-26 13:31:5855import "ui/gfx/geometry/mojom/geometry.mojom";
Kevin McNeeea7f3b82020-02-27 21:42:3256import "url/mojom/origin.mojom";
57import "url/mojom/url.mojom";
ben76f52b242016-06-18 05:42:4858
Miyoung Shin5d77f72072020-10-09 15:14:2059[Native]
60struct PageState;
61
Daniel Chengd1b775552021-02-19 18:50:0262// A View (i.e. a "main frame") can be created for a few different cases, these
63// values are used to specify which it is.
64enum ViewWidgetType {
65 // A standard view that's the top-level widget in a frame hierarchy.
66 kTopLevel,
67 // A GuestView used to render contents inside a <webview> element.
68 kGuestView,
69 // A view used to render contents inside a <portal> element.
70 kPortal
71};
72
73struct CreateViewParams {
74 // Renderer-wide preferences.
75 blink.mojom.RendererPreferences renderer_preferences;
76
77 // Preferences for this view.
78 blink.mojom.WebPreferences web_preferences;
79
80 // The ID of the view to be created.
81 int32 view_id = IPC.mojom.kRoutingIdNone;
82
83 // The session storage namespace ID this view should use.
84 string session_storage_namespace_id;
85
Anton Bikineevf62d1bf2021-05-15 17:56:0786 // The frame token of the opener frame if one exists, or absl::nullopt
Daniel Chengd1b775552021-02-19 18:50:0287 // otherwise.
Chris Hamilton2ea20312021-02-24 17:20:1488 blink.mojom.FrameToken? opener_frame_token;
Daniel Chengd1b775552021-02-19 18:50:0289
Daniel Cheng4daa51222021-02-21 07:20:1190 // Information that needs to be replicated to the view's main frame, e.g.
91 // frame name and sandbox flags.
Gyuyoung Kimc16e52e92021-03-19 02:45:3792 blink.mojom.FrameReplicationState replication_state;
Daniel Cheng4daa51222021-02-21 07:20:1193
94 // Used for devtools instrumentation and trace-ability. The token is shared
95 // across all frames (local or remotes) representing the same logical frame
96 // tree node, and is used by Blink and content to tag calls and requests for
97 // instrumentation purposes, allowing them to be attributed to a context
98 // frame.
99 //
100 // Must not be used to look up a RenderFrameHostImpl or RenderFrameProxyHost
101 // in the browser process, as the token is shared, making the mapping
102 // ambiguous and non-authoritative.
103 mojo_base.mojom.UnguessableToken devtools_main_frame_token;
104
Daniel Chengd1b775552021-02-19 18:50:02105 CreateMainFrameUnion main_frame;
106
107 // Whether the RenderView should initially be hidden.
108 bool hidden;
109
110 // When true, all RenderWidgets under this RenderView will never be shown to
111 // the user, and thus never composited, and will not need to produce pixels
112 // for display. This allows the renderer to optimize and avoid resources used
113 // for displaying graphical output.
114 bool never_composited;
115
116 // Whether the window associated with this view was created with an opener.
117 bool window_was_created_with_opener;
118
119 // Whether lookup of frames in the created RenderView (e.g. lookup via
120 // window.open or via <a target=...>) should be renderer-wide (i.e. going
121 // beyond the usual opener-relationship-based BrowsingInstance boundaries).
122 bool renderer_wide_named_frame_lookup;
123
124 // Indicates whether the view is a regular top-level widget or some other
125 // nested "main frame" widget type.
126 ViewWidgetType type;
127
128 // Endpoint for any messages that are broadcast to all views in a WebContents.
129 pending_associated_receiver<blink.mojom.PageBroadcast> blink_page_broadcast;
130};
131
Daniel Chengd1b775552021-02-19 18:50:02132// A union to distinguish between parameters specific to local main frame
133// creation and remote main frame creation.
134union CreateMainFrameUnion {
135 CreateLocalMainFrameParams local_params;
136 CreateRemoteMainFrameParams remote_params;
137};
138
139// Parameters used for browser-initiated local main frame creation.
140struct CreateLocalMainFrameParams {
Daniel Cheng4daa51222021-02-21 07:20:11141 // The frame token. Used to map between LocalFrame and RenderFrameHostImpl.
142 blink.mojom.LocalFrameToken token;
143
Daniel Chengd1b775552021-02-19 18:50:02144 // The ID of the main frame hosted in the view. Must not be kRoutingIdNone.
145 int32 routing_id = IPC.mojom.kRoutingIdNone;
146
147 // The communication interfaces for the WebLocalFrame in blink.
148 pending_associated_receiver<content.mojom.Frame> frame;
149
150 pending_remote<blink.mojom.BrowserInterfaceBroker> interface_broker;
151
152 // Whether or not the frame has previously committed a real load.
153 bool has_committed_real_load;
154
155 // Null when the main frame has no policy container yet (for example, because
156 // it is a speculative RenderFrameHost), and the policy container will be
157 // sent during CommitNavigation.
158 blink.mojom.PolicyContainer? policy_container;
159
160 CreateFrameWidgetParams widget_params;
Lukasz Anforowicz7624ae22021-04-14 16:17:50161
162 // Subresource loader factories to be used by the initial empty document.
163 blink.mojom.URLLoaderFactoryBundle subresource_loader_factories;
Daniel Chengd1b775552021-02-19 18:50:02164};
165
166// Parameters used for brower-initiated remote main frame creation.
167struct CreateRemoteMainFrameParams {
Daniel Cheng4daa51222021-02-21 07:20:11168 blink.mojom.RemoteFrameToken token;
169
Daniel Chengd1b775552021-02-19 18:50:02170 // The ID of the proxy object for the main frame in this view. Must not be
171 // kRoutingIdNone.
172 int32 routing_id = IPC.mojom.kRoutingIdNone;
173};
174
175// Parameters used for creating a new frame widget.
176struct CreateFrameWidgetParams {
177 // Gives the routing ID for the RenderWidget that will be attached to the
178 // new RenderFrame.
179 int32 routing_id;
180
181 // The communication interfaces for the WebFrameWidget in blink.
182 pending_associated_remote<blink.mojom.FrameWidgetHost> frame_widget_host;
183 pending_associated_receiver<blink.mojom.FrameWidget> frame_widget;
184 pending_associated_remote<blink.mojom.WidgetHost> widget_host;
185 pending_associated_receiver<blink.mojom.Widget> widget;
186
187 // The initial visual properties of the widget.
188 blink.mojom.VisualProperties visual_properties;
189};
190
191// Used for recreating child frames after a crash (does this still happen?) and
192// speculative/provisional frames (including main frame).
193//
194// "Normal" child frame creation (via inserting a new frame owner element into
195// the active document) does not use these params and is routed via
196// CreateChildFrame().
197//
198// "Normal" main frame creation (whether browser-initiated, e.g. opening a new
199// tab, or renderer-initiated, e.g. window.open()) also do not use these params
200// and are routed via CreateView() and CreateNewWindow() respectively.
201//
Daniel Chengd1b775552021-02-19 18:50:02202struct CreateFrameParams {
Daniel Cheng4daa51222021-02-21 07:20:11203 // The frame token. Used to map between LocalFrame and RenderFrameHostImpl.
204 blink.mojom.LocalFrameToken token;
205
Daniel Chengd1b775552021-02-19 18:50:02206 // Specifies the routing ID of the new RenderFrame object.
207 int32 routing_id;
208
209 // If a valid |previous_routing_id| is provided, the new frame will be
210 // configured to replace either the previous frame or the previous proxy on
211 // commit.
212 int32 previous_routing_id;
213
Daniel Chengd1b775552021-02-19 18:50:02214 // Specifies the new frame's opener. The opener will be null if this is
Anton Bikineevf62d1bf2021-05-15 17:56:07215 // absl::nullopt.
Chris Hamilton2ea20312021-02-24 17:20:14216 blink.mojom.FrameToken? opener_frame_token;
Daniel Chengd1b775552021-02-19 18:50:02217
218 // The new frame should be created as a child of the object
219 // identified by |parent_routing_id| or as top level if that is
220 // MSG_ROUTING_NONE.
221 int32 parent_routing_id;
222
223 // Identifies the previous sibling of the new frame, so that the new frame is
224 // inserted into the correct place in the frame tree. If this is
225 // MSG_ROUTING_NONE, the frame will be created as the leftmost child of its
226 // parent frame, in front of any other children.
227 int32 previous_sibling_routing_id;
228
229 pending_remote<blink.mojom.BrowserInterfaceBroker> interface_broker;
230
231 // When the new frame has a parent, |replication_state| holds the new frame's
232 // properties replicated from the process rendering the parent frame, such as
233 // the new frame's sandbox flags.
Gyuyoung Kimc16e52e92021-03-19 02:45:37234 blink.mojom.FrameReplicationState replication_state;
Daniel Chengd1b775552021-02-19 18:50:02235
236 // Used for devtools instrumentation and trace-ability. The token is
237 // propagated to Blink's LocalFrame and both Blink and content/
238 // can tag calls and requests with this instrumentation token in order to
239 // attribute them to the context frame.
240 // |devtools_frame_token| is only defined by the browser and is never
241 // sent back from the renderer in the control calls.
242 mojo_base.mojom.UnguessableToken devtools_frame_token;
243
244 // When the new frame has a parent, |frame_owner_properties| holds the
245 // properties of the HTMLFrameOwnerElement from the parent process.
246 // Note that unlike FrameReplicationState, this is not replicated for remote
247 // frames.
248 blink.mojom.FrameOwnerProperties frame_owner_properties;
249
250 // Specifies properties for a new RenderWidget that will be attached to the
251 // new RenderFrame (if one is needed).
252 CreateFrameWidgetParams? widget_params;
253
254 // Whether or not the frame has previously committed a real load.
255 bool has_committed_real_load;
256
257 // The policy container for the frame to be created. This can be null if we
258 // could not determine a policy container yet, for example in case of a
259 // speculative RenderFrameHost. In that case, the final policy container will
260 // be sent along CommitNavigation.
261 blink.mojom.PolicyContainer? policy_container;
262
263 // The mojo connection to the mojom::Frame in the renderer.
264 pending_associated_receiver<content.mojom.Frame> frame;
265};
266
Mario Sanchez Prada13bbad52020-06-01 18:12:29267// Provided with each call to Frame::GetSerializedHtmlWithLocalLinks() so that
268// the renderer can notify the browser process each time that a chunk of HTML
269// data gets serialized, as well as when the entire process is finished.
270interface FrameHTMLSerializerHandler {
271 // Sent by the renderer as a response to GetSerializedHtmlWithLocalLinks() to
272 // indicate that HTML data has been serialized, included in |data_buffer|.
273 DidReceiveData(string data_buffer);
274
275 // Reports that the serialization process is finished. It is expected to
276 // receive this message right after the last time DidReceiveData() is called.
277 Done();
278};
279
Dominic Mazzoni77d0aba2021-01-14 09:42:16280struct SnapshotAccessibilityTreeParams {
281 // See ui/accessibility/ax_mode.h for valid values of |ax_mode|.
282 uint32 ax_mode;
283
284 // If true, nodes that are entirely offscreen will have their entire
285 // subtree excluded. Note that this heuristic is imperfect, and
286 // an absolute-positioned node that's visible, but whose ancestors
287 // are entirely offscreen, may get excluded.
288 bool exclude_offscreen;
289
290 // The maximum number of nodes to snapshot before exiting early.
291 // Note that this is not a hard limit; once this limit is reached a
292 // few more nodes may be added in order to ensure a well-formed
293 // tree is returned. Use 0 for no max. The corresponding C++ code
294 // uses size_t.
295 uint64 max_nodes;
296
297 // The maximum amount of time to spend snapshotting the tree. Like
298 // max_nodes, this is not a hard limit, and once this limit is reached
299 // a few more nodes may be added in order to ensure a well-formed tree.
300 // Use 0 for no timeout.
301 mojo_base.mojom.TimeDelta timeout;
302};
303
Dave Tapuska795de45a2021-01-12 20:48:05304// An enumeration specifying the reason of the frame deletion.
305enum FrameDeleteIntention {
306 // The frame being deleted isn't a (speculative) main frame.
307 kNotMainFrame,
308 // The frame being deleted is a speculative main frame, and it is being
309 // deleted as part of the shutdown for that WebContents. The entire RenderView
310 // etc will be destroyed by a separate IPC sent later.
311 kSpeculativeMainFrameForShutdown,
312 // The frame being deleted is a speculative main frame, and it is being
313 // deleted because the speculative navigation was cancelled. This is not part
314 // of shutdown.
315 kSpeculativeMainFrameForNavigationCancelled,
316};
317
danakj0bdfacd2021-01-20 19:27:18318// Implemented by the frame provider, and must be associated with other content
319// mojoms bound to frames, widgets, views, and currently also with the legacy
320// IPC channel.
Arthur Hemeryd3011f62018-05-30 10:38:44321// KEEP THE COMMIT FUNCTIONS IN SYNC in content/common/navigation_client.mojom.
danakj0bdfacd2021-01-20 19:27:18322// These will eventually be removed from Frame.
323interface Frame {
clamyaf4bf2d92018-02-06 10:54:36324 // Tells the renderer that a same-document navigation should be committed.
325 // The renderer will return a status value indicating whether the commit
326 // could proceed as expected or not. In particular, it might be necessary to
327 // restart the navigation if it is no-longer same-document, which can happen
328 // if the renderer committed another navigation in the meantime.
329 CommitSameDocumentNavigation(
330 CommonNavigationParams common_params,
Nasko Oskovc36327d2019-01-03 23:23:04331 CommitNavigationParams request_params)
clamyaf4bf2d92018-02-06 10:54:36332 => (blink.mojom.CommitResult commit_result);
333
Chong Zhang7306b0b2018-01-24 05:59:24334 // Provides the renderer an updated |subresource_loader_factories|.
335 //
336 // This method is intended to fix broken loaders after a Network Service
337 // crash, and is only used when Network Service is enabled.
338 //
339 // The new bundle contains replacement factories for a subset of the
340 // receiver's existing bundle.
341 UpdateSubresourceLoaderFactories(
Hiroki Nakagawa753758342018-12-27 04:13:49342 blink.mojom.URLLoaderFactoryBundle subresource_loader_factories);
Dmitry Gozman6adf95b2018-10-10 22:12:19343
Ian Barkley-Yeungbda77fb2020-12-08 04:26:46344 // Indicates that the frame host (browser) wants the |untrusted_stack_trace|
345 // parameter of DidAddMessageToConsole() filled in for Error messages if at
346 // all possible.
347 SetWantErrorMessageStackTrace();
348
Dave Tapuskaca250702021-01-07 17:40:55349 // Unload this RenderFrame and replace it by a RenderFrameProxy, so the frame
350 // can navigate to a document rendered by a different process. The unload can
351 // fail if the RenderFrame is currently detached (it was removed from the
352 // frame tree before the Unload was received). If successful this message will
353 // send back AgentSchedulingGroupHost::DidUnloadRenderFrame message. This
354 // cannot be a standard reply callback because the unload acknowledgement must
355 // be posted back to the event loop to be invoked later. This is to ensure
356 // that any postMessage() calls executed by JS during unload are dispatched,
357 // since postMessage dispatch is always scheduled asynchronously.
358 Unload(int32 new_remote_frame_routing_id,
359 bool is_loading,
Gyuyoung Kimc16e52e92021-03-19 02:45:37360 blink.mojom.FrameReplicationState new_remote_frame_replication_state,
Chris Hamilton6c60a832021-02-19 20:35:46361 blink.mojom.RemoteFrameToken new_remote_frame_token);
Dave Tapuska795de45a2021-01-12 20:48:05362
363 // Delete the frame. This is only called for child frames that the browser
364 // wants to detach, or for speculative main frames which are owned by the
365 // browser process. Committed main frames are owned by the renderer's WebView
366 // and can not be deleted directly.
367 Delete(FrameDeleteIntention intention);
danakj0bdfacd2021-01-20 19:27:18368
369 // Causes all new subresource requests to be blocked (not being started) until
370 // ResumeBlockedRequests is called.
371 BlockRequests();
372
373 // Resumes blocked requests.
374 // It is safe to call this without calling BlockRequests.
375 ResumeBlockedRequests();
376
377 GetInterfaceProvider(
378 pending_receiver<service_manager.mojom.InterfaceProvider> interfaces);
379
danakj0bdfacd2021-01-20 19:27:18380 // Requests a one-time snapshot of the accessibility tree without enabling
381 // accessibility if it wasn't already enabled.
382 SnapshotAccessibilityTree(SnapshotAccessibilityTreeParams params)
383 => (ax.mojom.AXTreeUpdate snapshot);
384
385 // Get HTML data by serializing the target frame and replacing all resource
386 // links with a path to the local copy passed in the message payload. In order
387 // to report progress to the the browser process, a pending remote is passed
388 // via |callback_remote|, so that direct communication with the SavePackage
389 // object that initiated the process can be established.
390 GetSerializedHtmlWithLocalLinks(
391 map<url.mojom.Url, mojo_base.mojom.FilePath> url_map,
Chris Hamilton2ea20312021-02-24 17:20:14392 map<blink.mojom.FrameToken, mojo_base.mojom.FilePath>
danakj0bdfacd2021-01-20 19:27:18393 frame_token_map, bool save_with_empty_url,
394 pending_remote<FrameHTMLSerializerHandler> handler_remote);
Ken Rockot48785452017-10-25 19:33:14395};
396
sammc7f6c6a02017-01-30 00:53:51397// Implemented by the frame (e.g. renderer processes).
398// Instances of this interface must be associated with (i.e., FIFO with) the
399// legacy IPC channel.
400interface FrameBindingsControl {
401 // Used to tell a render frame whether it should expose various bindings
402 // that allow JS content extended privileges. See BindingsPolicy for valid
403 // flag values.
404 AllowBindings(int32 enabled_bindings_flags);
Nasko Oskov8a73f7d2019-09-27 22:29:32405
406 // Used to tell the RenderFrame to enable Mojo JS bindings, which allows
407 // JS code running in the renderer process to connect to Mojo interfaces
408 // and make method calls on them.
409 // This is used for WebUI only at this time.
410 EnableMojoJsBindings();
Miyoung Shin072d4052020-07-13 07:52:44411
412 // Used to bind WebUI and WebUIHost mojo connections.
Daniel Cheng4b931a4f2020-12-18 01:59:35413 BindWebUI(pending_associated_receiver<content.mojom.WebUI> receiver,
414 pending_associated_remote<content.mojom.WebUIHost> remote);
sammc7f6c6a02017-01-30 00:53:51415};
416
csharrison95f01e922017-04-24 18:52:35417struct CreateNewWindowParams {
Mustaq Ahmed8601a562020-01-31 18:05:52418 // True if ContentRendererClient allows popups. This is the case only for
419 // extensions.
420 bool allow_popup;
csharrison95f01e922017-04-24 18:52:35421
422 // Type of window requested.
423 WindowContainerType window_container_type;
424
425 // The session storage namespace ID this window should use.
Daniel Murphy31bbb8b12018-02-07 21:44:10426 string session_storage_namespace_id;
csharrison95f01e922017-04-24 18:52:35427
Daniel Murphye3eec92c2018-02-23 19:09:15428 // The session storage namespace ID this window should clone from.
429 // TODO(dmurph): Remove this once session storage is fully mojo'd, as the
430 // clone call happens on a different interface. https://crbug.com/716490
431 string clone_from_session_storage_namespace_id;
432
csharrison95f01e922017-04-24 18:52:35433 // The name of the resulting frame that should be created (empty if none
434 // has been specified). UTF8 encoded string.
435 string frame_name;
436
csharrison95f01e922017-04-24 18:52:35437 // Whether the opener will be suppressed in the new window, in which case
438 // scripting the new window is not allowed.
439 bool opener_suppressed;
440
441 // Whether the window should be opened in the foreground, background, etc.
442 ui.mojom.WindowOpenDisposition disposition;
443
444 // The URL that will be loaded in the new window (empty if none has been
445 // specified).
446 url.mojom.Url target_url;
447
448 // The referrer that will be used to load |target_url| (empty if none has
449 // been specified).
450 blink.mojom.Referrer referrer;
451
452 // The window features to use for the new window.
453 blink.mojom.WindowFeatures features;
John Delaney8623c642021-01-06 17:37:07454
455 // The impression associated with the navigation in the new window, if
456 // one is specified.
457 Impression? impression;
csharrison95f01e922017-04-24 18:52:35458};
459
Daniel Cheng8bb30c62017-10-23 20:40:47460// Operation result when the renderer asks the browser to create a new window.
461enum CreateNewWindowStatus {
462 // Ignore creation of the new window. This can happen because creation is
463 // blocked or because the new window should have no opener relationship.
464 kIgnore,
465 // Reuse the current window rather than creating a new window.
466 kReuse,
467 // Create a new window using the corresponding params in |reply|.
468 kSuccess,
469};
470
471// All routing IDs in this struct must be set to a valid routing ID.
Daniel Cheng4daa51222021-02-21 07:20:11472// TODO(dcheng): It's almost possible to use CreateLocalMainFrameParams here.
473// See if there's a reasonable way to factor out state here by splitting things
474// into browser-created params vs renderer-created params.
csharrison95f01e922017-04-24 18:52:35475struct CreateNewWindowReply {
Daniel Cheng8bb30c62017-10-23 20:40:47476 // The ID of the view to be created.
csharrison95f01e922017-04-24 18:52:35477 int32 route_id;
478
Daniel Cheng4daa51222021-02-21 07:20:11479 // The unique identifier of the RenderFrameHost
480 blink.mojom.LocalFrameToken main_frame_token;
481
csharrison95f01e922017-04-24 18:52:35482 // The ID of the main frame hosted in the view.
483 int32 main_frame_route_id;
484
danakj0bdfacd2021-01-20 19:27:18485 // The pending mojo connection to the Frame implementation in the renderer.
486 pending_associated_receiver<content.mojom.Frame> frame;
487
Daniel Chengd1b775552021-02-19 18:50:02488 CreateFrameWidgetParams widget_params;
Dave Tapuska8499eec2020-03-16 17:54:30489
Yuzu Saijod46f498a2020-08-04 02:56:22490 // The communication interfaces for the PageBroadcast.
491 pending_associated_receiver<blink.mojom.PageBroadcast> page_broadcast;
492
Ken Rockotc4a0ada92020-12-02 00:22:14493 pending_remote<blink.mojom.BrowserInterfaceBroker>
494 main_frame_interface_broker;
Balazs Engedyba034e72017-10-27 22:26:28495
csharrison95f01e922017-04-24 18:52:35496 // Duplicated from CreateNewWindowParams because legacy code.
Daniel Murphy31bbb8b12018-02-07 21:44:10497 string cloned_session_storage_namespace_id;
Pavel Feldman08beed7842017-10-17 19:18:11498
Daniel Cheng4daa51222021-02-21 07:20:11499 // Used for devtools instrumentation and trace-ability. The token is shared
500 // across all frames (local or remotes) representing the same logical frame
501 // tree node, and is used by Blink and content to tag calls and requests for
502 // instrumentation purposes, allowing them to be attributed to a context
503 // frame.
504 //
505 // Must not be used to look up a RenderFrameHostImpl or RenderFrameProxyHost
506 // in the browser process, as the token is shared, making the mapping
507 // ambiguous and non-authoritative.
Oksana Zhuravlova34579e912018-03-23 00:18:49508 mojo_base.mojom.UnguessableToken devtools_main_frame_token;
Yury Semikhatsky82730ff2020-02-25 22:29:26509
510 // Used by devtools instrumentation to tell devtools agent in the renderer
511 // that it should pause created window and wait for an explicit resume command
512 // from the client.
513 bool wait_for_debugger;
Antonio Sartori7f809cc72020-10-30 07:47:20514
515 // The policy container for the new frame that will be created by Blink in
516 // response.
Antonio Sartori9290b6b2020-11-09 10:09:33517 blink.mojom.PolicyContainer policy_container;
csharrison95f01e922017-04-24 18:52:35518};
519
520// Implemented by the frame server (i.e. the browser process). For messages that
521// must be associated with the IPC channel.
522interface FrameHost {
Daniel Cheng8bb30c62017-10-23 20:40:47523 // Sent by the renderer to request the browser to create a new window. |reply|
524 // is only non-null on when status == CreateNewWindowStatus::kSuccess.
csharrison95f01e922017-04-24 18:52:35525 [Sync] CreateNewWindow(CreateNewWindowParams params)
Daniel Cheng8bb30c62017-10-23 20:40:47526 => (CreateNewWindowStatus status, CreateNewWindowReply? reply);
Yutaka Hiranof7f2f632017-09-06 10:40:08527
Lucas Furukawa Gadani99125822019-01-03 15:41:49528 // Sent by the renderer process to request the creation of a new portal.
Adithya Srinivasane8bf80e2019-05-01 15:39:31529 // |portal| is the pipe to be used for the Portal object, |client| is the pipe
Dave Tapuska84449382020-05-01 00:39:04530 // used to communicate back with the caller. Returns:
531 // |proxy_routing_id| - the routing id of the RenderFrameProxy
532 // |initial_replicated_state| - the replicated state associated with that
533 // RenderFrameProxy
534 // |portal_token| - the unique identifier for the portal
535 // |frame_token| - the unique identifier of the RenderFrameProxy
536 // |devtools_frame_token| - the unique identifier of the frame node in the
537 // frame tree
Jeremy Romand92e1372019-06-04 16:31:17538 [Sync] CreatePortal(
539 pending_associated_receiver<blink.mojom.Portal> portal,
540 pending_associated_remote<blink.mojom.PortalClient> client)
Lucas Furukawa Gadani99125822019-01-03 15:41:49541 => (int32 proxy_routing_id,
Gyuyoung Kimc16e52e92021-03-19 02:45:37542 blink.mojom.FrameReplicationState initial_replicated_state,
Adithya Srinivasanea4760c2020-07-30 15:44:57543 blink.mojom.PortalToken portal_token,
Chris Hamilton6c60a832021-02-19 20:35:46544 blink.mojom.RemoteFrameToken frame_token,
Lucas Furukawa Gadanif68204d2019-04-30 17:30:24545 mojo_base.mojom.UnguessableToken devtools_frame_token);
Lucas Furukawa Gadani99125822019-01-03 15:41:49546
Lucas Furukawa Gadani56dd5452019-03-22 18:23:12547 // Requests that this frame adopts the portal identified by |portal_token|.
Dave Tapuska84449382020-05-01 00:39:04548 // Returns:
549 // |proxy_routing_id| - the routing id of the portal's RenderFrameProxy
550 // |replicated_state| - the replicated state associated with that
551 // RenderFrameProxy
552 // |frame_token| - the unique identifier of the RenderFrameProxy
553 // |devtools_frame_token| - the unique identifier of the frame node in the
554 // frame tree
Adithya Srinivasanea4760c2020-07-30 15:44:57555 [Sync] AdoptPortal(blink.mojom.PortalToken portal_token)
Lucas Furukawa Gadanif68204d2019-04-30 17:30:24556 => (int32 proxy_routing_id,
Gyuyoung Kimc16e52e92021-03-19 02:45:37557 blink.mojom.FrameReplicationState replicated_state,
Chris Hamilton6c60a832021-02-19 20:35:46558 blink.mojom.RemoteFrameToken frame_token,
Lucas Furukawa Gadanif68204d2019-04-30 17:30:24559 mojo_base.mojom.UnguessableToken devtools_frame_token);
Lucas Furukawa Gadani56dd5452019-03-22 18:23:12560
Dave Tapuska4e60c232020-11-05 15:49:32561 // Asynchronously creates a child frame. A routing ID must be allocated first
562 // by calling RenderMessageFilter::GenerateFrameRoutingID()
563 // Each of these messages will have a corresponding mojom::FrameHost::Detach
564 // API sent when the frame is detached from the DOM.
565 CreateChildFrame(int32 child_routing_id,
danakj0bdfacd2021-01-20 19:27:18566 pending_associated_remote<content.mojom.Frame> frame,
Dave Tapuska4e60c232020-11-05 15:49:32567 pending_receiver<blink.mojom.BrowserInterfaceBroker>
568 browser_interface_broker,
Antonio Sartoridb967c52021-01-20 09:54:30569 blink.mojom.PolicyContainerBindParams
570 policy_container_bind_params,
Dave Tapuska4e60c232020-11-05 15:49:32571 blink.mojom.TreeScopeType scope,
572 string frame_name,
573 string frame_unique_name,
574 bool is_created_by_script,
575 blink.mojom.FramePolicy frame_policy,
576 blink.mojom.FrameOwnerProperties frame_owner_properties,
577 blink.mojom.FrameOwnerElementType frame_owner_element_type);
578
Balazs Engedya40712f2017-09-15 15:01:11579 // Sent by the renderer when a navigation commits in the frame.
Oksana Zhuravlova8b88e572019-01-07 21:54:00580
581 // If |interface_params| is non-empty, the FrameHost implementation
Ken Rockot228182e2020-12-01 18:43:59582 // must unbind the old BrowserInterfaceBroker connections, and drop any
583 // interface requests pending on them. Then it should bind the appropriate
584 // requests and start servicing GetInterface messages coming in on these new
585 // connections in a security context that is appropriate for the committed
586 // navigation.
Balazs Engedy0c8d550b2017-12-06 21:30:23587 //
Oksana Zhuravlova8b88e572019-01-07 21:54:00588 // The FrameHost implementation must enforce that |interface_params|
Balazs Engedy0c8d550b2017-12-06 21:30:23589 // is set for cross-document navigations. This prevents origin confusion by
590 // ensuring that interface requests racing with navigation commit will be
591 // either ignored, or serviced correctly in the security context of the
Ken Rockot228182e2020-12-01 18:43:59592 // document they originated from (based on which BrowserInterfaceBroker
593 // connection the GetInterface messages arrive on).
Balazs Engedya40712f2017-09-15 15:01:11594 DidCommitProvisionalLoad(
Balazs Engedy0c8d550b2017-12-06 21:30:23595 DidCommitProvisionalLoadParams params,
Oksana Zhuravlova8b88e572019-01-07 21:54:00596 DidCommitProvisionalLoadInterfaceParams? interface_params);
Arthur Hemery7b67a972017-12-01 15:24:49597
Arthur Hemery7b0ae492018-02-05 16:04:45598 // Sent by the renderer to indicate that a same document navigation
599 // committed in the renderer process.
600 DidCommitSameDocumentNavigation(
Rakina Zata Amni26357782020-12-03 11:45:01601 DidCommitProvisionalLoadParams params,
602 DidCommitSameDocumentNavigationParams same_document_params);
Arthur Hemery7b0ae492018-02-05 16:04:45603
Arthur Hemery7b67a972017-12-01 15:24:49604 // Sent by the renderer to request a navigation.
Marijn Kruisselbrink07bf59d52018-04-03 21:50:25605 // |blob_url_token| should be non-null when this is a navigation to a blob:
606 // URL. The token will then be used to look up the blob associated with the
607 // blob URL. Without this by the time the navigation code starts fetching
608 // the URL the blob URL might no longer be valid. |blob_url_token| is
609 // not part of BeginNavigationParams because that struct needs to be
610 // cloneable, and thus can't contain mojo interfaces.
611 // If an invalid BlobURLToken is passed in, or if the token doesn't match the
612 // url in |common_params|, the navigation will result in a network error.
Arthur Hemeryd3011f62018-05-30 10:38:44613 // |navigation_client| is passed to the renderer to allow for further control
Nasko Oskovd22f9bf872020-12-23 00:31:35614 // of the navigation. Allows for Commit and Cancels/Aborts.
Antonio Sartoridb967c52021-01-20 09:54:30615 // Passing the |initiator_policy_container_keep_alive_handle| is just a means
616 // to ensure that the PolicyContainerHost of the initiator RenderFrameHost is
617 // kept alive, even if the RenderFrameHost itself has already been deleted in
618 // the meantime. If this can be ensured in other ways, it is safe to pass a
619 // mojo::NullRemote. In particular, if the initiator LocalFrame is alive when
620 // issuing this mojo call, there is no need to pass
621 // |initiator_policy_container_keep_alive_handle|, since the initiator
622 // PolicyContainerHost is kept alive by LocalFrame's PolicyContainer.
Arthur Hemeryd3011f62018-05-30 10:38:44623 // TODO(ahemery): |navigation_client| should not be optional. Make it
Nasko Oskovd22f9bf872020-12-23 00:31:35624 // mandatory.
Arthur Hemery7b67a972017-12-01 15:24:49625 BeginNavigation(
626 CommonNavigationParams common_params,
Marijn Kruisselbrink07bf59d52018-04-03 21:50:25627 BeginNavigationParams begin_params,
Julie Jeongeun Kim249cfbb2019-08-30 06:44:05628 pending_remote<blink.mojom.BlobURLToken>? blob_url_token,
Julie Jeongeun Kimed2e5ba72019-09-12 10:14:17629 pending_associated_remote<NavigationClient>? navigation_client,
Antonio Sartoridb967c52021-01-20 09:54:30630 pending_remote<blink.mojom.PolicyContainerHostKeepAliveHandle>?
631 initiator_policy_container_keep_alive_handle);
John Abd-El-Malekd4882642017-12-04 21:45:19632
633 // Sent when a subresource response has started.
Jay Civellid5904f02018-03-23 19:43:57634 // |cert_status| is the bitmask of status info of the SSL certificate. (see
635 // net/cert/cert_status_flags.h).
Lukasz Anforowiczd334bba2020-02-10 23:32:55636 SubresourceResponseStarted(url.mojom.Url url, uint32 cert_status);
Jay Civellid5904f02018-03-23 19:43:57637
Jay Civelli116683f2018-03-27 19:56:23638 // Sent when a resource load finished, successfully or not.
Minggang Wangee5af392020-02-05 02:55:28639 ResourceLoadComplete(blink.mojom.ResourceLoadInfo url_load_info);
Luciano Pacheco8def47f2017-12-07 06:52:30640
641 // Sent when the frame changes its window.name.
642 DidChangeName(string name, string unique_name);
643
Austin Tankiang10d64832017-12-20 02:43:55644 // If a cross-process navigation was started for the initial history load in
645 // this subframe, this tries to cancel it to allow a client redirect to happen
646 // instead.
647 CancelInitialHistoryLoad();
648
649 // Change the encoding name of the page in UI when the page has detected
650 // proper encoding name. Sent for top-level frames.
651 UpdateEncoding(string encoding_name);
Lucas Furukawa Gadanie5d27a362018-02-13 14:26:02652
Clark DuValla0e42992018-09-17 17:00:11653 // Updates information to determine whether a user gesture should carryover to
654 // future navigations. This is needed so navigations within a certain
655 // timeframe of a request initiated by a gesture will be treated as if they
656 // were initiated by a gesture too, otherwise the navigation may be blocked.
657 [EnableIf=is_android]
658 UpdateUserGestureCarryoverInfo();
Lowell Manners9499addc2019-03-12 11:05:32659
Gyuyoung Kimbc7dee642020-06-17 01:43:29660 // Notifies the browser that this frame has new session history information.
Ken Rockot4da6ac02020-10-27 01:28:25661 //
662 // NOTE: PageState can be quite large when serialized, and its message
663 // structure must remain stable; hence [UnlimitedSize] for this message.
664 [UnlimitedSize]
Gyuyoung Kimbc7dee642020-06-17 01:43:29665 UpdateState(PageState state);
Gyuyoung Kim0028790a2020-06-26 00:09:00666
667 // Requests that the given URL be opened in the specified manner.
Yeunjoo Choi9232ea32021-03-08 16:25:17668 OpenURL(blink.mojom.OpenURLParams params);
Gyuyoung Kim847ecc72020-07-21 14:07:55669
670 // Called when the renderer is done loading a frame.
671 DidStopLoading();
ben76f52b242016-06-18 05:42:48672};