blob: 6867426b4d0f9953079b90502241d313721a6404 [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";
Oksana Zhuravlova34579e912018-03-23 00:18:4916import "mojo/public/mojom/base/unguessable_token.mojom";
Hajime Hoshi35ad74f2019-03-07 08:38:0517import "mojo/public/mojom/base/values.mojom";
arthursonzogni42eabe012020-01-17 15:55:5618import "services/network/public/mojom/content_security_policy.mojom";
Ken Rockot54311e62018-02-10 19:01:5219import "services/network/public/mojom/url_loader.mojom";
Kinuko Yasudad795ac72018-07-11 08:07:5320import "services/network/public/mojom/url_loader_factory.mojom";
arthursonzogni42eabe012020-01-17 15:55:5621import "services/network/public/mojom/url_response_head.mojom";
Ken Rockot543f5e32018-02-04 02:13:5022import "services/service_manager/public/mojom/interface_provider.mojom";
Lucas Furukawa Gadani7bca98a2019-12-11 21:44:2523import "services/viz/public/mojom/compositing/frame_sink_id.mojom";
Miyoung Shin99505dd2019-07-27 12:45:3524import "services/viz/public/mojom/compositing/surface_id.mojom";
Blink Reformata30d4232018-04-07 15:31:0625import "third_party/blink/public/mojom/blob/blob_url_store.mojom";
Dave Tapuska4e60c232020-11-05 15:49:3226import "third_party/blink/public/mojom/browser_interface_broker.mojom";
Julie Jeongeun Kim42a90df2019-03-20 23:13:1027import "third_party/blink/public/mojom/commit_result/commit_result.mojom";
Lowell Mannersf03ea5a2019-04-23 11:47:5828import "third_party/blink/public/mojom/devtools/console_message.mojom";
Kevin McNeeea7f3b82020-02-27 21:42:3229import "third_party/blink/public/mojom/devtools/devtools_agent.mojom";
Dave Tapuska4e60c232020-11-05 15:49:3230import "third_party/blink/public/mojom/frame/frame_owner_element_type.mojom";
31import "third_party/blink/public/mojom/frame/frame_owner_properties.mojom";
32import "third_party/blink/public/mojom/frame/frame_policy.mojom";
Dave Tapuskad6703f912019-01-31 23:13:1133import "third_party/blink/public/mojom/frame/lifecycle.mojom";
Andy Paicuc93d30862018-10-10 15:33:4534import "third_party/blink/public/mojom/frame/navigation_initiator.mojom";
Antonio Sartori7f809cc72020-10-30 07:47:2035import "third_party/blink/public/mojom/frame/policy_container.mojom";
Dave Tapuska4e60c232020-11-05 15:49:3236import "third_party/blink/public/mojom/frame/tree_scope_type.mojom";
Minggang Wangee5af392020-02-05 02:55:2837import "third_party/blink/public/mojom/loader/resource_load_info.mojom";
Hiroki Nakagawa753758342018-12-27 04:13:4938import "third_party/blink/public/mojom/loader/url_loader_factory_bundle.mojom";
Yuzu Saijoaae91702019-03-13 07:38:0539import "third_party/blink/public/mojom/messaging/transferable_message.mojom";
Yuzu Saijod46f498a2020-08-04 02:56:2240import "third_party/blink/public/mojom/page/page.mojom";
Dave Tapuska8499eec2020-03-16 17:54:3041import "third_party/blink/public/mojom/page/widget.mojom";
Lucas Furukawa Gadani89a74182019-01-10 19:33:2242import "third_party/blink/public/mojom/portal/portal.mojom";
Hiroki Nakagawa60693aa2020-07-16 09:01:4143import "third_party/blink/public/mojom/loader/referrer.mojom";
Hiroki Nakagawacdbc7912018-11-30 11:30:0544import "third_party/blink/public/mojom/service_worker/controller_service_worker.mojom";
Hiroki Nakagawa077f20962020-05-15 08:04:4445import "third_party/blink/public/mojom/service_worker/service_worker_container.mojom";
Chris Hamiltona46b15442020-07-31 14:38:5646import "third_party/blink/public/mojom/tokens/tokens.mojom";
Dave Tapuska9a31f412020-07-20 17:01:2847import "third_party/blink/public/mojom/widget/visual_properties.mojom";
Julie Jeongeun Kim42a90df2019-03-20 23:13:1048import "third_party/blink/public/mojom/window_features/window_features.mojom";
Mario Sanchez Prada5d7f1ac2020-07-16 17:18:4049import "ui/accessibility/mojom/ax_tree_update.mojom";
Julie Jeongeun Kim2b1d45a2019-06-28 23:37:5450import "ui/base/mojom/window_open_disposition.mojom";
Miyoung Shin87943f502019-07-26 13:31:5851import "ui/gfx/geometry/mojom/geometry.mojom";
Kevin McNeeea7f3b82020-02-27 21:42:3252import "url/mojom/origin.mojom";
53import "url/mojom/url.mojom";
ben76f52b242016-06-18 05:42:4854
Miyoung Shin5d77f72072020-10-09 15:14:2055[Native]
56struct PageState;
57
Mario Sanchez Prada13bbad52020-06-01 18:12:2958// Provided with each call to Frame::GetSerializedHtmlWithLocalLinks() so that
59// the renderer can notify the browser process each time that a chunk of HTML
60// data gets serialized, as well as when the entire process is finished.
61interface FrameHTMLSerializerHandler {
62 // Sent by the renderer as a response to GetSerializedHtmlWithLocalLinks() to
63 // indicate that HTML data has been serialized, included in |data_buffer|.
64 DidReceiveData(string data_buffer);
65
66 // Reports that the serialization process is finished. It is expected to
67 // receive this message right after the last time DidReceiveData() is called.
68 Done();
69};
70
ben76f52b242016-06-18 05:42:4871// Implemented by the frame provider (e.g. renderer processes).
72interface Frame {
Gyuyoung Kim6c9ce9022019-11-26 05:40:0873 GetInterfaceProvider(
74 pending_receiver<service_manager.mojom.InterfaceProvider> interfaces);
Daniel Cheng118f9e282017-11-10 03:28:4475 GetCanonicalUrlForSharing() => (url.mojom.Url? canonical_url);
Luciano Pacheco8528c16f2017-12-14 07:10:5676
John Abd-El-Malek9405d80e2018-08-08 16:50:2177 // Causes all new subresource requests to be blocked (not being started) until
78 // ResumeBlockedRequests is called.
79 BlockRequests();
80
81 // Resumes blocked requests.
82 // It is safe to call this without calling BlockRequests.
83 ResumeBlockedRequests();
84
Luciano Pacheco8528c16f2017-12-14 07:10:5685 // Samsung Galaxy Note-specific "smart clip" stylus text getter.
86 // Extracts the data at the given rect.
Eve Martin-Jones40f552c2018-02-14 22:47:3287 [EnableIf=is_android]
Luciano Pacheco8528c16f2017-12-14 07:10:5688 ExtractSmartClipData(gfx.mojom.Rect rect)
Mahesh Machavolu346cd2662018-05-24 12:40:1189 => (mojo_base.mojom.String16 text, mojo_base.mojom.String16 html,
90 gfx.mojom.Rect clip_rect);
Scott Violet0de3837c2019-09-06 22:51:5491
92 // Notifies the renderer whether hiding/showing the browser controls is
93 // enabled, what the current state should be, and whether or not to
94 // animate to the proper state.
Dave Tapuskafc4adbae2020-12-02 22:08:5995 UpdateBrowserControlsState(cc.mojom.BrowserControlsState constraints,
96 cc.mojom.BrowserControlsState current,
Scott Violet0de3837c2019-09-06 22:51:5497 bool animate);
Mario Sanchez Prada749007a2020-03-13 16:48:2998
99 // Requests a one-time snapshot of the accessibility tree without enabling
100 // accessibility if it wasn't already enabled.
101 // See ui/accessibility/ax_mode.h for valid values of |ax_mode|.
Ken Rockot4da6ac02020-10-27 01:28:25102 //
103 // TODO(crbug.com/1141990): AXTreeUpdate can be quite large, hence the
104 // [UnlimitedSize] tag. It may be possible to remove this if AXTreeUpdate
105 // can be reworked to avoid very large serialized values.
Mario Sanchez Prada749007a2020-03-13 16:48:29106 SnapshotAccessibilityTree(uint32 ax_mode)
Mario Sanchez Prada5d7f1ac2020-07-16 17:18:40107 => (ax.mojom.AXTreeUpdate snapshot);
Mario Sanchez Prada13bbad52020-06-01 18:12:29108
109 // Get HTML data by serializing the target frame and replacing all resource
110 // links with a path to the local copy passed in the message payload. In order
111 // to report progress to the the browser process, a pending remote is passed
112 // via |callback_remote|, so that direct communication with the SavePackage
113 // object that initiated the process can be established.
114 GetSerializedHtmlWithLocalLinks(
115 map<url.mojom.Url, mojo_base.mojom.FilePath> url_map,
116 map<mojo_base.mojom.UnguessableToken, mojo_base.mojom.FilePath>
117 frame_token_map, bool save_with_empty_url,
118 pending_remote<FrameHTMLSerializerHandler> handler_remote);
ben76f52b242016-06-18 05:42:48119};
120
Ken Rockot48785452017-10-25 19:33:14121// Implemented by the frame provider and currently must be associated with the
122// legacy IPC channel.
Arthur Hemeryd3011f62018-05-30 10:38:44123// KEEP THE COMMIT FUNCTIONS IN SYNC in content/common/navigation_client.mojom.
124// These will eventually be removed from FrameNavigationControl.
Ken Rockot48785452017-10-25 19:33:14125interface FrameNavigationControl {
clamyaf4bf2d92018-02-06 10:54:36126 // Tells the renderer that a same-document navigation should be committed.
127 // The renderer will return a status value indicating whether the commit
128 // could proceed as expected or not. In particular, it might be necessary to
129 // restart the navigation if it is no-longer same-document, which can happen
130 // if the renderer committed another navigation in the meantime.
131 CommitSameDocumentNavigation(
132 CommonNavigationParams common_params,
Nasko Oskovc36327d2019-01-03 23:23:04133 CommitNavigationParams request_params)
clamyaf4bf2d92018-02-06 10:54:36134 => (blink.mojom.CommitResult commit_result);
135
clamyb1df7b962018-02-01 17:38:17136 // Asks the renderer to handle a renderer-debug URL.
137 HandleRendererDebugURL(url.mojom.Url url);
138
Chong Zhang7306b0b2018-01-24 05:59:24139 // Provides the renderer an updated |subresource_loader_factories|.
140 //
141 // This method is intended to fix broken loaders after a Network Service
142 // crash, and is only used when Network Service is enabled.
143 //
144 // The new bundle contains replacement factories for a subset of the
145 // receiver's existing bundle.
146 UpdateSubresourceLoaderFactories(
Hiroki Nakagawa753758342018-12-27 04:13:49147 blink.mojom.URLLoaderFactoryBundle subresource_loader_factories);
Dmitry Gozman6adf95b2018-10-10 22:12:19148
149 // Returns a DevToolsAgent interface for this frame, used for
150 // remote debugging. See DevToolsAgent for details.
151 // Returned DevToolsAgent must be associated with navigation control,
152 // due to various ordering dependencies between DevTools protocol and
153 // navigation.
Julie Jeongeun Kim07887792019-08-13 11:05:48154 BindDevToolsAgent(
155 pending_associated_remote<blink.mojom.DevToolsAgentHost> agent_host,
Andrey Kosyakov5bb020f2020-03-19 17:28:19156 pending_associated_receiver<blink.mojom.DevToolsAgent> agent);
Hajime Hoshi35ad74f2019-03-07 08:38:05157
Maksim Sadymcfb8f8d2020-09-30 20:30:45158 // Request for the renderer to execute a given JavaScript method on a given
159 // object (both identified by name) in the frame's context.
160 //
161 // |object_name| is the global name of the object.
162 //
163 // |method_name| is the name of the method on the object.
164 //
165 // |arguments| is the list of arguments to pass to the method invocation.
166 //
167 // |wants_result| is true if the result of this execution is required by the
168 // caller. If it is false, a reply is still required by Mojo, but a null value
169 // should be returned to avoid issues serializing a large, unwanted reply.
170 JavaScriptMethodExecuteRequest(
171 mojo_base.mojom.String16 object_name,
172 mojo_base.mojom.String16 method_name,
173 mojo_base.mojom.ListValue arguments,
174 bool wants_result) => (mojo_base.mojom.Value result);
175
Hajime Hoshi35ad74f2019-03-07 08:38:05176 // Request for the renderer to execute JavaScript in the frame's context.
177 //
178 // |javascript| is the string containing the JavaScript to be executed in the
Avi Drissman90630d92020-04-29 21:17:36179 // target frame's context. Note that this uses BigString16 rather than
180 // String16 as this is used in contexts, like DevTools, where the contents of
181 // the JavaScript script is user-provided, and therefore we can't guarantee
182 // the size of the script.
Hajime Hoshi35ad74f2019-03-07 08:38:05183 //
Avi Drissman8e3ebe92019-06-10 20:26:11184 // |wants_result| is true if the result of this execution is required by the
185 // caller. If it is false, a reply is still required by Mojo, but a null value
186 // should be returned to avoid issues serializing a large, unwanted reply.
187 //
Hajime Hoshi35ad74f2019-03-07 08:38:05188 // TODO(hajimehoshi): This requires navigate association to keep the message
189 // order with other navigation-related messages. Fix this and move this to a
190 // non-navigate-related interface if possible.
Avi Drissman4544828f2019-03-11 20:37:32191 JavaScriptExecuteRequest(
Avi Drissman90630d92020-04-29 21:17:36192 mojo_base.mojom.BigString16 javascript,
Avi Drissman8e3ebe92019-06-10 20:26:11193 bool wants_result) => (mojo_base.mojom.Value result);
Hajime Hoshi35ad74f2019-03-07 08:38:05194
Mustaq Ahmed02cd8832019-12-05 15:46:56195 // ONLY FOR TESTS: Same as above but this can optionally trigger a fake user
196 // activation notification to test functionalities that are gated by user
197 // activation.
Avi Drissman4544828f2019-03-11 20:37:32198 JavaScriptExecuteRequestForTests(
Avi Drissman90630d92020-04-29 21:17:36199 mojo_base.mojom.BigString16 javascript,
Avi Drissman8e3ebe92019-06-10 20:26:11200 bool wants_result,
Hajime Hoshif85e7cf722019-07-19 00:54:49201 bool has_user_gesture,
202 int32 world_id)
Avi Drissman4544828f2019-03-11 20:37:32203 => (mojo_base.mojom.Value result);
Hajime Hoshi35ad74f2019-03-07 08:38:05204
205 // Same as JavaScriptExecuteRequest above except the script is run in the
206 // isolated world specified by the fourth parameter.
Avi Drissman4544828f2019-03-11 20:37:32207 JavaScriptExecuteRequestInIsolatedWorld(
Avi Drissman90630d92020-04-29 21:17:36208 mojo_base.mojom.BigString16 javascript,
Avi Drissman8e3ebe92019-06-10 20:26:11209 bool wants_result,
Avi Drissman4544828f2019-03-11 20:37:32210 int32 world_id) => (mojo_base.mojom.Value result);
Yuzu Saijoaae91702019-03-13 07:38:05211
Gyuyoung Kim11aad0b62020-04-29 16:00:26212 // Requests that a provisional RenderFrame swap itself into the frame tree,
213 // replacing the RenderFrameProxy that it is associated with. This is used
214 // with remote-to-local frame navigations when the RenderFrameProxy
215 // corresponds to a non-live (crashed) frame. In that case, the browser
216 // process will send this message as part of an early commit to stop showing
217 // the sad iframe without waiting for the provisional RenderFrame's navigation
218 // to commit.
219 SwapIn();
Ken Rockot48785452017-10-25 19:33:14220};
221
sammc7f6c6a02017-01-30 00:53:51222// Implemented by the frame (e.g. renderer processes).
223// Instances of this interface must be associated with (i.e., FIFO with) the
224// legacy IPC channel.
225interface FrameBindingsControl {
226 // Used to tell a render frame whether it should expose various bindings
227 // that allow JS content extended privileges. See BindingsPolicy for valid
228 // flag values.
229 AllowBindings(int32 enabled_bindings_flags);
Nasko Oskov8a73f7d2019-09-27 22:29:32230
231 // Used to tell the RenderFrame to enable Mojo JS bindings, which allows
232 // JS code running in the renderer process to connect to Mojo interfaces
233 // and make method calls on them.
234 // This is used for WebUI only at this time.
235 EnableMojoJsBindings();
Miyoung Shin072d4052020-07-13 07:52:44236
237 // Used to bind WebUI and WebUIHost mojo connections.
238 BindWebUI(pending_receiver<content.mojom.WebUI> receiver,
239 pending_remote<content.mojom.WebUIHost> remote);
sammc7f6c6a02017-01-30 00:53:51240};
241
ben76f52b242016-06-18 05:42:48242// Implemented by a service that provides implementations of the Frame
243// interface. (e.g. renderer processes).
244interface FrameFactory {
Henrique Ferreiro3a9751c2019-09-30 13:54:07245 CreateFrame(int32 frame_routing_id, pending_receiver<Frame> frame);
csharrison95f01e922017-04-24 18:52:35246};
247
csharrison95f01e922017-04-24 18:52:35248struct CreateNewWindowParams {
Mustaq Ahmed8601a562020-01-31 18:05:52249 // True if ContentRendererClient allows popups. This is the case only for
250 // extensions.
251 bool allow_popup;
csharrison95f01e922017-04-24 18:52:35252
253 // Type of window requested.
254 WindowContainerType window_container_type;
255
256 // The session storage namespace ID this window should use.
Daniel Murphy31bbb8b12018-02-07 21:44:10257 string session_storage_namespace_id;
csharrison95f01e922017-04-24 18:52:35258
Daniel Murphye3eec92c2018-02-23 19:09:15259 // The session storage namespace ID this window should clone from.
260 // TODO(dmurph): Remove this once session storage is fully mojo'd, as the
261 // clone call happens on a different interface. https://crbug.com/716490
262 string clone_from_session_storage_namespace_id;
263
csharrison95f01e922017-04-24 18:52:35264 // The name of the resulting frame that should be created (empty if none
265 // has been specified). UTF8 encoded string.
266 string frame_name;
267
csharrison95f01e922017-04-24 18:52:35268 // Whether the opener will be suppressed in the new window, in which case
269 // scripting the new window is not allowed.
270 bool opener_suppressed;
271
272 // Whether the window should be opened in the foreground, background, etc.
273 ui.mojom.WindowOpenDisposition disposition;
274
275 // The URL that will be loaded in the new window (empty if none has been
276 // specified).
277 url.mojom.Url target_url;
278
279 // The referrer that will be used to load |target_url| (empty if none has
280 // been specified).
281 blink.mojom.Referrer referrer;
282
283 // The window features to use for the new window.
284 blink.mojom.WindowFeatures features;
285};
286
Daniel Cheng8bb30c62017-10-23 20:40:47287// Operation result when the renderer asks the browser to create a new window.
288enum CreateNewWindowStatus {
289 // Ignore creation of the new window. This can happen because creation is
290 // blocked or because the new window should have no opener relationship.
291 kIgnore,
292 // Reuse the current window rather than creating a new window.
293 kReuse,
294 // Create a new window using the corresponding params in |reply|.
295 kSuccess,
296};
297
298// All routing IDs in this struct must be set to a valid routing ID.
csharrison95f01e922017-04-24 18:52:35299struct CreateNewWindowReply {
Daniel Cheng8bb30c62017-10-23 20:40:47300 // The ID of the view to be created.
csharrison95f01e922017-04-24 18:52:35301 int32 route_id;
302
303 // The ID of the main frame hosted in the view.
304 int32 main_frame_route_id;
305
Dave Tapuska84449382020-05-01 00:39:04306 // The unique identifier of the RenderFrameHost
307 mojo_base.mojom.UnguessableToken main_frame_frame_token;
308
csharrison95f01e922017-04-24 18:52:35309 // The ID of the widget for the main frame.
310 int32 main_frame_widget_route_id;
311
danakjbe56b8132019-10-12 00:57:41312 // Initial properties for the main frame RenderWidget.
Dave Tapuska9a31f412020-07-20 17:01:28313 blink.mojom.VisualProperties visual_properties;
danakjbe56b8132019-10-12 00:57:41314
Dave Tapuska8499eec2020-03-16 17:54:30315 // The communication interfaces for the WebFrameWidget in blink.
316 pending_associated_remote<blink.mojom.FrameWidgetHost> frame_widget_host;
317 pending_associated_receiver<blink.mojom.FrameWidget> frame_widget;
318 pending_associated_remote<blink.mojom.WidgetHost> widget_host;
319 pending_associated_receiver<blink.mojom.Widget> widget;
320
Yuzu Saijod46f498a2020-08-04 02:56:22321 // The communication interfaces for the PageBroadcast.
322 pending_associated_receiver<blink.mojom.PageBroadcast> page_broadcast;
323
Ken Rockotc4a0ada92020-12-02 00:22:14324 pending_remote<blink.mojom.BrowserInterfaceBroker>
325 main_frame_interface_broker;
Balazs Engedyba034e72017-10-27 22:26:28326
csharrison95f01e922017-04-24 18:52:35327 // Duplicated from CreateNewWindowParams because legacy code.
Daniel Murphy31bbb8b12018-02-07 21:44:10328 string cloned_session_storage_namespace_id;
Pavel Feldman08beed7842017-10-17 19:18:11329
330 // Used for devtools instrumentation and trace-ability. The token is
331 // propagated to Blink's LocalFrame and both Blink and content/
332 // can tag calls and requests with this instrumentation token in order to
333 // attribute them to the context frame.
334 // |devtools_frame_token| is only defined by the browser and is never
335 // sent back from the renderer in the control calls.
Oksana Zhuravlova34579e912018-03-23 00:18:49336 mojo_base.mojom.UnguessableToken devtools_main_frame_token;
Yury Semikhatsky82730ff2020-02-25 22:29:26337
338 // Used by devtools instrumentation to tell devtools agent in the renderer
339 // that it should pause created window and wait for an explicit resume command
340 // from the client.
341 bool wait_for_debugger;
Antonio Sartori7f809cc72020-10-30 07:47:20342
343 // The policy container for the new frame that will be created by Blink in
344 // response.
Antonio Sartori9290b6b2020-11-09 10:09:33345 blink.mojom.PolicyContainer policy_container;
csharrison95f01e922017-04-24 18:52:35346};
347
Gyuyoung Kim0028790a2020-06-26 00:09:00348[Native]
349enum TriggeringEventInfo;
350
351// This struct holds parameters included in the OpenURL method sent by the
352// renderer to the browser, |is_history_navigation_in_new_child_frame| is true
353// in the case that the browser process should look for an existing history item
354// for the frame.
355struct OpenURLParams {
356 // The main URL to open.
357 url.mojom.Url url;
358 url.mojom.Origin initiator_origin;
359 int32 initiator_routing_id;
360 network.mojom.URLRequestBody? post_body;
361 string extra_headers;
362 blink.mojom.Referrer referrer;
363
364 // The window position to open the URL.
365 ui.mojom.WindowOpenDisposition disposition;
366 bool should_replace_current_entry;
367 bool user_gesture;
368
369 // Extra information about the triggering of the OpenURL.
370 TriggeringEventInfo triggering_event_info;
Daniel Cheng13251e52020-11-25 17:41:23371 pending_remote<blink.mojom.BlobURLToken>? blob_url_token;
Gyuyoung Kim0028790a2020-06-26 00:09:00372 string href_translate;
373 Impression? impression;
374 NavigationDownloadPolicy download_policy;
375};
376
csharrison95f01e922017-04-24 18:52:35377// Implemented by the frame server (i.e. the browser process). For messages that
378// must be associated with the IPC channel.
379interface FrameHost {
Daniel Cheng8bb30c62017-10-23 20:40:47380 // Sent by the renderer to request the browser to create a new window. |reply|
381 // is only non-null on when status == CreateNewWindowStatus::kSuccess.
csharrison95f01e922017-04-24 18:52:35382 [Sync] CreateNewWindow(CreateNewWindowParams params)
Daniel Cheng8bb30c62017-10-23 20:40:47383 => (CreateNewWindowStatus status, CreateNewWindowReply? reply);
Yutaka Hiranof7f2f632017-09-06 10:40:08384
Lucas Furukawa Gadani99125822019-01-03 15:41:49385 // Sent by the renderer process to request the creation of a new portal.
Adithya Srinivasane8bf80e2019-05-01 15:39:31386 // |portal| is the pipe to be used for the Portal object, |client| is the pipe
Dave Tapuska84449382020-05-01 00:39:04387 // used to communicate back with the caller. Returns:
388 // |proxy_routing_id| - the routing id of the RenderFrameProxy
389 // |initial_replicated_state| - the replicated state associated with that
390 // RenderFrameProxy
391 // |portal_token| - the unique identifier for the portal
392 // |frame_token| - the unique identifier of the RenderFrameProxy
393 // |devtools_frame_token| - the unique identifier of the frame node in the
394 // frame tree
Jeremy Romand92e1372019-06-04 16:31:17395 [Sync] CreatePortal(
396 pending_associated_receiver<blink.mojom.Portal> portal,
397 pending_associated_remote<blink.mojom.PortalClient> client)
Lucas Furukawa Gadani99125822019-01-03 15:41:49398 => (int32 proxy_routing_id,
Kevin McNee51ef5dc2020-01-13 17:52:37399 FrameReplicationState initial_replicated_state,
Adithya Srinivasanea4760c2020-07-30 15:44:57400 blink.mojom.PortalToken portal_token,
Dave Tapuska84449382020-05-01 00:39:04401 mojo_base.mojom.UnguessableToken frame_token,
Lucas Furukawa Gadanif68204d2019-04-30 17:30:24402 mojo_base.mojom.UnguessableToken devtools_frame_token);
Lucas Furukawa Gadani99125822019-01-03 15:41:49403
Lucas Furukawa Gadani56dd5452019-03-22 18:23:12404 // Requests that this frame adopts the portal identified by |portal_token|.
Dave Tapuska84449382020-05-01 00:39:04405 // Returns:
406 // |proxy_routing_id| - the routing id of the portal's RenderFrameProxy
407 // |replicated_state| - the replicated state associated with that
408 // RenderFrameProxy
409 // |frame_token| - the unique identifier of the RenderFrameProxy
410 // |devtools_frame_token| - the unique identifier of the frame node in the
411 // frame tree
Adithya Srinivasanea4760c2020-07-30 15:44:57412 [Sync] AdoptPortal(blink.mojom.PortalToken portal_token)
Lucas Furukawa Gadanif68204d2019-04-30 17:30:24413 => (int32 proxy_routing_id,
Lucas Furukawa Gadani7bca98a2019-12-11 21:44:25414 viz.mojom.FrameSinkId frame_sink_id,
Jeremy Roman62fee222019-07-09 17:34:14415 FrameReplicationState replicated_state,
Dave Tapuska84449382020-05-01 00:39:04416 mojo_base.mojom.UnguessableToken frame_token,
Lucas Furukawa Gadanif68204d2019-04-30 17:30:24417 mojo_base.mojom.UnguessableToken devtools_frame_token);
Lucas Furukawa Gadani56dd5452019-03-22 18:23:12418
Dave Tapuskad9835622020-03-10 17:32:31419
420 // Similar to CreateNewWindow, except used for sub-widgets, like <select>
Dave Tapuska04ccda062020-10-21 21:58:12421 // dropdowns. Upon return, the renderer side popup will be owned by the
422 // PopupWidgetHost.
Dave Tapuskad95cfb32020-11-02 17:04:55423 CreateNewPopupWidget(
Dave Tapuska04ccda062020-10-21 21:58:12424 pending_associated_receiver<blink.mojom.PopupWidgetHost> popup_host,
Dave Tapuska8499eec2020-03-16 17:54:30425 pending_associated_receiver<blink.mojom.WidgetHost> blink_widget_host,
Dave Tapuskad95cfb32020-11-02 17:04:55426 pending_associated_remote<blink.mojom.Widget> blink_widget);
Dave Tapuskad9835622020-03-10 17:32:31427
Dave Tapuska4e60c232020-11-05 15:49:32428 // Asynchronously creates a child frame. A routing ID must be allocated first
429 // by calling RenderMessageFilter::GenerateFrameRoutingID()
430 // Each of these messages will have a corresponding mojom::FrameHost::Detach
431 // API sent when the frame is detached from the DOM.
432 CreateChildFrame(int32 child_routing_id,
Dave Tapuska4e60c232020-11-05 15:49:32433 pending_receiver<blink.mojom.BrowserInterfaceBroker>
434 browser_interface_broker,
Antonio Sartoria1fd1432020-11-25 09:10:20435 pending_associated_receiver<blink.mojom.PolicyContainerHost>
436 policy_container_associated_receiver,
Dave Tapuska4e60c232020-11-05 15:49:32437 blink.mojom.TreeScopeType scope,
438 string frame_name,
439 string frame_unique_name,
440 bool is_created_by_script,
441 blink.mojom.FramePolicy frame_policy,
442 blink.mojom.FrameOwnerProperties frame_owner_properties,
443 blink.mojom.FrameOwnerElementType frame_owner_element_type);
444
Balazs Engedya40712f2017-09-15 15:01:11445 // Sent by the renderer when a navigation commits in the frame.
Oksana Zhuravlova8b88e572019-01-07 21:54:00446
447 // If |interface_params| is non-empty, the FrameHost implementation
Ken Rockot228182e2020-12-01 18:43:59448 // must unbind the old BrowserInterfaceBroker connections, and drop any
449 // interface requests pending on them. Then it should bind the appropriate
450 // requests and start servicing GetInterface messages coming in on these new
451 // connections in a security context that is appropriate for the committed
452 // navigation.
Balazs Engedy0c8d550b2017-12-06 21:30:23453 //
Oksana Zhuravlova8b88e572019-01-07 21:54:00454 // The FrameHost implementation must enforce that |interface_params|
Balazs Engedy0c8d550b2017-12-06 21:30:23455 // is set for cross-document navigations. This prevents origin confusion by
456 // ensuring that interface requests racing with navigation commit will be
457 // either ignored, or serviced correctly in the security context of the
Ken Rockot228182e2020-12-01 18:43:59458 // document they originated from (based on which BrowserInterfaceBroker
459 // connection the GetInterface messages arrive on).
Balazs Engedya40712f2017-09-15 15:01:11460 DidCommitProvisionalLoad(
Balazs Engedy0c8d550b2017-12-06 21:30:23461 DidCommitProvisionalLoadParams params,
Oksana Zhuravlova8b88e572019-01-07 21:54:00462 DidCommitProvisionalLoadInterfaceParams? interface_params);
Arthur Hemery7b67a972017-12-01 15:24:49463
Arthur Hemery7b0ae492018-02-05 16:04:45464 // Sent by the renderer to indicate that a same document navigation
465 // committed in the renderer process.
466 DidCommitSameDocumentNavigation(
467 DidCommitProvisionalLoadParams params);
468
Arthur Hemery7b67a972017-12-01 15:24:49469 // Sent by the renderer to request a navigation.
Marijn Kruisselbrink07bf59d52018-04-03 21:50:25470 // |blob_url_token| should be non-null when this is a navigation to a blob:
471 // URL. The token will then be used to look up the blob associated with the
472 // blob URL. Without this by the time the navigation code starts fetching
473 // the URL the blob URL might no longer be valid. |blob_url_token| is
474 // not part of BeginNavigationParams because that struct needs to be
475 // cloneable, and thus can't contain mojo interfaces.
476 // If an invalid BlobURLToken is passed in, or if the token doesn't match the
477 // url in |common_params|, the navigation will result in a network error.
Arthur Hemeryd3011f62018-05-30 10:38:44478 // |navigation_client| is passed to the renderer to allow for further control
479 // of the navigation. Allows for Commit and Cancels/Aborts. It is only valid
480 // when PerNavigationMojoInterface is enabled.
481 // TODO(ahemery): |navigation_client| should not be optional. Make it
482 // mandatory when removing PerNavigationMojoInterface feature flag.
Arthur Hemery7b67a972017-12-01 15:24:49483 BeginNavigation(
484 CommonNavigationParams common_params,
Marijn Kruisselbrink07bf59d52018-04-03 21:50:25485 BeginNavigationParams begin_params,
Julie Jeongeun Kim249cfbb2019-08-30 06:44:05486 pending_remote<blink.mojom.BlobURLToken>? blob_url_token,
Julie Jeongeun Kimed2e5ba72019-09-12 10:14:17487 pending_associated_remote<NavigationClient>? navigation_client,
Miyoung Shinda5da322019-09-02 10:07:37488 pending_remote<blink.mojom.NavigationInitiator>? navigation_initiator);
John Abd-El-Malekd4882642017-12-04 21:45:19489
490 // Sent when a subresource response has started.
Jay Civellid5904f02018-03-23 19:43:57491 // |cert_status| is the bitmask of status info of the SSL certificate. (see
492 // net/cert/cert_status_flags.h).
Lukasz Anforowiczd334bba2020-02-10 23:32:55493 SubresourceResponseStarted(url.mojom.Url url, uint32 cert_status);
Jay Civellid5904f02018-03-23 19:43:57494
Jay Civelli116683f2018-03-27 19:56:23495 // Sent when a resource load finished, successfully or not.
Minggang Wangee5af392020-02-05 02:55:28496 ResourceLoadComplete(blink.mojom.ResourceLoadInfo url_load_info);
Luciano Pacheco8def47f2017-12-07 06:52:30497
498 // Sent when the frame changes its window.name.
499 DidChangeName(string name, string unique_name);
500
Austin Tankiang10d64832017-12-20 02:43:55501 // If a cross-process navigation was started for the initial history load in
502 // this subframe, this tries to cancel it to allow a client redirect to happen
503 // instead.
504 CancelInitialHistoryLoad();
505
506 // Change the encoding name of the page in UI when the page has detected
507 // proper encoding name. Sent for top-level frames.
508 UpdateEncoding(string encoding_name);
Lucas Furukawa Gadanie5d27a362018-02-13 14:26:02509
Lucas Gadani471160f92018-03-01 03:13:21510 // The frame's size is replicated in the browser so that the browser can
511 // correctly set the initial size of the frame in case of a cross-process
512 // navigation.
513 FrameSizeChanged(gfx.mojom.Size size);
Becca Hughesfd5d8f892018-06-14 18:23:36514
Clark DuValla0e42992018-09-17 17:00:11515 // Updates information to determine whether a user gesture should carryover to
516 // future navigations. This is needed so navigations within a certain
517 // timeframe of a request initiated by a gesture will be treated as if they
518 // were initiated by a gesture too, otherwise the navigation may be blocked.
519 [EnableIf=is_android]
520 UpdateUserGestureCarryoverInfo();
Lowell Manners9499addc2019-03-12 11:05:32521
Ian Barkley-Yeung07d8a262020-11-19 22:45:35522 // Blink and JavaScript error messages to log to the console, debugger UI, or
523 // error reporting service. |source_id| is usually a URL.
524 // |untrusted_stack_trace| should only be printed or sent to other services;
525 // it's untrusted and should not be parsed to get a structured stack trace.
526 // The stack trace is only present if the message is from an exception and
527 // only if Frame.SetWantExceptionStackTrace has been called for this frame.
Lowell Mannersf03ea5a2019-04-23 11:47:58528 DidAddMessageToConsole(
529 blink.mojom.ConsoleMessageLevel log_level,
530 mojo_base.mojom.BigString16 msg,
531 int32 line_number,
Ian Barkley-Yeung07d8a262020-11-19 22:45:35532 mojo_base.mojom.String16 source_id,
533 mojo_base.mojom.BigString16? untrusted_stack_trace);
Lowell Mannersf03ea5a2019-04-23 11:47:58534
Gyuyoung Kimbc7dee642020-06-17 01:43:29535 // Notifies the browser that this frame has new session history information.
Ken Rockot4da6ac02020-10-27 01:28:25536 //
537 // NOTE: PageState can be quite large when serialized, and its message
538 // structure must remain stable; hence [UnlimitedSize] for this message.
539 [UnlimitedSize]
Gyuyoung Kimbc7dee642020-06-17 01:43:29540 UpdateState(PageState state);
Gyuyoung Kim0028790a2020-06-26 00:09:00541
542 // Requests that the given URL be opened in the specified manner.
543 OpenURL(OpenURLParams params);
Gyuyoung Kim847ecc72020-07-21 14:07:55544
545 // Called when the renderer is done loading a frame.
546 DidStopLoading();
ben76f52b242016-06-18 05:42:48547};