blob: 7732f32c65b3f080dc56eaffc3ceb5f8ae83cecf [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
Arthur Hemery7b67a972017-12-01 15:24:497import "content/common/navigation_params.mojom";
Kinuko Yasudaba384082018-01-11 08:30:168import "content/common/service_worker/controller_service_worker.mojom";
Ken Rockotbe87ab322017-11-02 19:40:239import "content/common/url_loader_factory_bundle.mojom";
John Abd-El-Malekd4882642017-12-04 21:45:1910import "content/public/common/resource_type.mojom";
csharrison95f01e922017-04-24 18:52:3511import "content/public/common/window_container_type.mojom";
Pavel Feldman08beed7842017-10-17 19:18:1112import "mojo/common/unguessable_token.mojom";
Ken Rockot8b447d72018-02-03 20:30:4713import "mojo/public/mojom/base/string16.mojom";
Ken Rockot54311e62018-02-10 19:01:5214import "services/network/public/mojom/url_loader.mojom";
Ken Rockot543f5e32018-02-04 02:13:5015import "services/service_manager/public/mojom/interface_provider.mojom";
Kinuko Yasuda275afbc2018-02-20 10:43:0716import "third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom";
csharrison95f01e922017-04-24 18:52:3517import "third_party/WebKit/public/platform/referrer.mojom";
clamyaf4bf2d92018-02-06 10:54:3618import "third_party/WebKit/public/web/commit_result.mojom";
csharrison95f01e922017-04-24 18:52:3519import "third_party/WebKit/public/web/window_features.mojom";
20import "ui/base/mojo/window_open_disposition.mojom";
Daniel Cheng7a059b02018-02-03 10:04:1321import "url/mojom/url.mojom";
Luciano Pacheco8528c16f2017-12-14 07:10:5622import "ui/gfx/geometry/mojo/geometry.mojom";
ben76f52b242016-06-18 05:42:4823
ben275a5652016-10-28 16:55:5024// The name of the InterfaceProviderSpec in service manifests used by the
25// frame tree to expose frame-specific interfaces between renderer and browser.
26const string kNavigation_FrameSpec = "navigation:frame";
27
ben76f52b242016-06-18 05:42:4828// Implemented by the frame provider (e.g. renderer processes).
29interface Frame {
rockot400ea35b2016-10-15 19:15:3230 GetInterfaceProvider(service_manager.mojom.InterfaceProvider& interfaces);
Daniel Cheng118f9e282017-11-10 03:28:4431 GetCanonicalUrlForSharing() => (url.mojom.Url? canonical_url);
Luciano Pacheco8528c16f2017-12-14 07:10:5632
33 // Samsung Galaxy Note-specific "smart clip" stylus text getter.
34 // Extracts the data at the given rect.
Eve Martin-Jones40f552c2018-02-14 22:47:3235 [EnableIf=is_android]
Luciano Pacheco8528c16f2017-12-14 07:10:5636 ExtractSmartClipData(gfx.mojom.Rect rect)
Ken Rockot8b447d72018-02-03 20:30:4737 => (mojo_base.mojom.String16 text, mojo_base.mojom.String16 html);
ben76f52b242016-06-18 05:42:4838};
39
Ken Rockot48785452017-10-25 19:33:1440// See src/content/common/navigation_params.h
41[Native]
42struct CommonNavigationParams;
43
44// See src/content/common/navigation_params.h
45[Native]
46struct RequestNavigationParams;
47
48// Implemented by the frame provider and currently must be associated with the
49// legacy IPC channel.
50interface FrameNavigationControl {
arthursonzogni3a4ca9f2017-12-07 17:58:3451 // Tells the renderer that a navigation is ready to commit.
52 //
53 // The renderer should request |body_url| to get access to the stream
54 // containing the body of the response. When the Network Service or
55 // NavigationMojoResponse is enabled, |body_url| is not used and instead
56 // |url_loader_client_endpoints| provides a way to continue the navigation.
57 //
58 // Note: |body_url| and |url_loader_client_endpoints| will be empty iff the
59 // navigation URL wasn't handled by the network stack (i.e. JavaScript URLs,
60 // renderer debug URLs, same document navigations, about:blank, ...)
61 //
62 // When the Network Service is enabled, |subresource_loader_factories| may
63 // also be provided by the browser as a a means for the renderer to load
64 // subresources where applicable.
Pavel Feldmanf20fc9d2017-11-17 09:13:3065 //
arthursonzognib950d902018-02-08 09:27:1366 // When S13nServiceWorker/NavigationMojoResponse is enabled,
67 // |controller_service_worker_info| may also be provided by the browser if the
68 // frame that is being navigated is supposed to be controlled by a Service
69 // Worker.
Kinuko Yasudaba384082018-01-11 08:30:1670 //
Pavel Feldmanf20fc9d2017-11-17 09:13:3071 // For automation driver-initiated navigations over the devtools protocol,
72 // |devtools_navigation_token_| is used to tag the navigation. This navigation
73 // token is then sent into the renderer and lands on the DocumentLoader. That
74 // way subsequent Blink-level frame lifecycle events can be associated with
75 // the concrete navigation.
76 // - The value should not be sent back to the browser.
77 // - The value on DocumentLoader may be generated in the renderer in some
78 // cases, and thus shouldn't be trusted.
79 // TODO(crbug.com/783506): Replace devtools navigation token with the generic
80 // navigation token that can be passed from renderer to the browser.
arthursonzogni3a4ca9f2017-12-07 17:58:3481 CommitNavigation(
John Abd-El-Malekb165dc52018-01-18 17:12:1882 network.mojom.URLResponseHead head,
arthursonzogni3a4ca9f2017-12-07 17:58:3483 url.mojom.Url body_url,
84 CommonNavigationParams common_params,
85 RequestNavigationParams request_params,
John Abd-El-Malekb165dc52018-01-18 17:12:1886 network.mojom.URLLoaderClientEndpoints? url_loader_client_endpoints,
arthursonzogni3a4ca9f2017-12-07 17:58:3487 URLLoaderFactoryBundle? subresource_loader_factories,
Kinuko Yasudaba384082018-01-11 08:30:1688 ControllerServiceWorkerInfo? controller_service_worker_info,
arthursonzogni3a4ca9f2017-12-07 17:58:3489 mojo.common.mojom.UnguessableToken devtools_navigation_token);
Doug Turner84693be2017-12-19 00:18:4690
91 // Tells the renderer that a failed navigation is ready to commit.
92 //
93 // The result of this commit usually results in displaying an error page.
94 // Note |error_page_content| may contain the content of the error page
95 // (i.e. flattened HTML, JS, CSS).
96 //
97 // When the Network Service is enabled, |subresource_loader_factories| may
98 // also be provided by the browser as a a means for the renderer to load
99 // subresources where applicable.
100 CommitFailedNavigation(
101 CommonNavigationParams common_params,
102 RequestNavigationParams request_params,
103 bool has_stale_copy_in_cache,
104 int32 error_code,
105 string? error_page_content,
106 URLLoaderFactoryBundle? subresource_loader_factories);
Chong Zhang7306b0b2018-01-24 05:59:24107
clamyaf4bf2d92018-02-06 10:54:36108 // Tells the renderer that a same-document navigation should be committed.
109 // The renderer will return a status value indicating whether the commit
110 // could proceed as expected or not. In particular, it might be necessary to
111 // restart the navigation if it is no-longer same-document, which can happen
112 // if the renderer committed another navigation in the meantime.
113 CommitSameDocumentNavigation(
114 CommonNavigationParams common_params,
115 RequestNavigationParams request_params)
116 => (blink.mojom.CommitResult commit_result);
117
clamyb1df7b962018-02-01 17:38:17118 // Asks the renderer to handle a renderer-debug URL.
119 HandleRendererDebugURL(url.mojom.Url url);
120
Chong Zhang7306b0b2018-01-24 05:59:24121 // Provides the renderer an updated |subresource_loader_factories|.
122 //
123 // This method is intended to fix broken loaders after a Network Service
124 // crash, and is only used when Network Service is enabled.
125 //
126 // The new bundle contains replacement factories for a subset of the
127 // receiver's existing bundle.
128 UpdateSubresourceLoaderFactories(
129 URLLoaderFactoryBundle subresource_loader_factories);
Ken Rockot48785452017-10-25 19:33:14130};
131
sammc7f6c6a02017-01-30 00:53:51132// Implemented by the frame (e.g. renderer processes).
133// Instances of this interface must be associated with (i.e., FIFO with) the
134// legacy IPC channel.
135interface FrameBindingsControl {
136 // Used to tell a render frame whether it should expose various bindings
137 // that allow JS content extended privileges. See BindingsPolicy for valid
138 // flag values.
139 AllowBindings(int32 enabled_bindings_flags);
140};
141
ben76f52b242016-06-18 05:42:48142// Implemented by a service that provides implementations of the Frame
143// interface. (e.g. renderer processes).
144interface FrameFactory {
Balazs Engedyba034e72017-10-27 22:26:28145 CreateFrame(int32 frame_routing_id, Frame& frame);
csharrison95f01e922017-04-24 18:52:35146};
147
csharrison95f01e922017-04-24 18:52:35148struct CreateNewWindowParams {
149 // True if this open request came in the context of a user gesture.
150 bool user_gesture;
151
152 // Type of window requested.
153 WindowContainerType window_container_type;
154
155 // The session storage namespace ID this window should use.
Daniel Murphy31bbb8b12018-02-07 21:44:10156 string session_storage_namespace_id;
csharrison95f01e922017-04-24 18:52:35157
Daniel Murphye3eec92c2018-02-23 19:09:15158 // The session storage namespace ID this window should clone from.
159 // TODO(dmurph): Remove this once session storage is fully mojo'd, as the
160 // clone call happens on a different interface. https://crbug.com/716490
161 string clone_from_session_storage_namespace_id;
162
csharrison95f01e922017-04-24 18:52:35163 // The name of the resulting frame that should be created (empty if none
164 // has been specified). UTF8 encoded string.
165 string frame_name;
166
csharrison95f01e922017-04-24 18:52:35167 // Whether the opener will be suppressed in the new window, in which case
168 // scripting the new window is not allowed.
169 bool opener_suppressed;
170
171 // Whether the window should be opened in the foreground, background, etc.
172 ui.mojom.WindowOpenDisposition disposition;
173
174 // The URL that will be loaded in the new window (empty if none has been
175 // specified).
176 url.mojom.Url target_url;
177
178 // The referrer that will be used to load |target_url| (empty if none has
179 // been specified).
180 blink.mojom.Referrer referrer;
181
182 // The window features to use for the new window.
183 blink.mojom.WindowFeatures features;
184};
185
Daniel Cheng8bb30c62017-10-23 20:40:47186// Operation result when the renderer asks the browser to create a new window.
187enum CreateNewWindowStatus {
188 // Ignore creation of the new window. This can happen because creation is
189 // blocked or because the new window should have no opener relationship.
190 kIgnore,
191 // Reuse the current window rather than creating a new window.
192 kReuse,
193 // Create a new window using the corresponding params in |reply|.
194 kSuccess,
195};
196
197// All routing IDs in this struct must be set to a valid routing ID.
csharrison95f01e922017-04-24 18:52:35198struct CreateNewWindowReply {
Daniel Cheng8bb30c62017-10-23 20:40:47199 // The ID of the view to be created.
csharrison95f01e922017-04-24 18:52:35200 int32 route_id;
201
202 // The ID of the main frame hosted in the view.
203 int32 main_frame_route_id;
204
205 // The ID of the widget for the main frame.
206 int32 main_frame_widget_route_id;
207
Balazs Engedyba034e72017-10-27 22:26:28208 // The InterfaceProvider through which the main RenderFrame can access
209 // services exposed by its RenderFrameHost.
210 service_manager.mojom.InterfaceProvider main_frame_interface_provider;
211
csharrison95f01e922017-04-24 18:52:35212 // Duplicated from CreateNewWindowParams because legacy code.
Daniel Murphy31bbb8b12018-02-07 21:44:10213 string cloned_session_storage_namespace_id;
Pavel Feldman08beed7842017-10-17 19:18:11214
215 // Used for devtools instrumentation and trace-ability. The token is
216 // propagated to Blink's LocalFrame and both Blink and content/
217 // can tag calls and requests with this instrumentation token in order to
218 // attribute them to the context frame.
219 // |devtools_frame_token| is only defined by the browser and is never
220 // sent back from the renderer in the control calls.
221 mojo.common.mojom.UnguessableToken devtools_main_frame_token;
csharrison95f01e922017-04-24 18:52:35222};
223
Yutaka Hiranof7f2f632017-09-06 10:40:08224// An opaque handle that keeps alive the associated render process even after
225// the frame is detached. Used by resource requests with "keepalive" specified.
226interface KeepAliveHandle {};
227
Balazs Engedya40712f2017-09-15 15:01:11228[Native]
229struct DidCommitProvisionalLoadParams;
230
csharrison95f01e922017-04-24 18:52:35231// Implemented by the frame server (i.e. the browser process). For messages that
232// must be associated with the IPC channel.
233interface FrameHost {
Daniel Cheng8bb30c62017-10-23 20:40:47234 // Sent by the renderer to request the browser to create a new window. |reply|
235 // is only non-null on when status == CreateNewWindowStatus::kSuccess.
csharrison95f01e922017-04-24 18:52:35236 [Sync] CreateNewWindow(CreateNewWindowParams params)
Daniel Cheng8bb30c62017-10-23 20:40:47237 => (CreateNewWindowStatus status, CreateNewWindowReply? reply);
Yutaka Hiranof7f2f632017-09-06 10:40:08238
239 // Creates and returns a KeepAliveHandle.
240 IssueKeepAliveHandle(KeepAliveHandle& keep_alive_handle);
Balazs Engedya40712f2017-09-15 15:01:11241
242 // Sent by the renderer when a navigation commits in the frame.
Balazs Engedy0c8d550b2017-12-06 21:30:23243 //
244 // If |interface_provider_request| is non-empty, the FrameHost implementation
245 // must unbind the old InterfaceProvider connection, and drop any interface
246 // requests pending on it. Then it should bind |interface_provider_request|
247 // and start servicing GetInterface messages coming in on this new connection
248 // in a security context that is appropriate for the committed navigation.
249 //
250 // The FrameHost implementation must enforce that |interface_provider_request|
251 // is set for cross-document navigations. This prevents origin confusion by
252 // ensuring that interface requests racing with navigation commit will be
253 // either ignored, or serviced correctly in the security context of the
254 // document they originated from (based on which InterfaceProvider connection
255 // the GetInterface messages arrive on).
Balazs Engedya40712f2017-09-15 15:01:11256 DidCommitProvisionalLoad(
Balazs Engedy0c8d550b2017-12-06 21:30:23257 DidCommitProvisionalLoadParams params,
258 service_manager.mojom.InterfaceProvider&? interface_provider_request);
Arthur Hemery7b67a972017-12-01 15:24:49259
Arthur Hemery7b0ae492018-02-05 16:04:45260 // Sent by the renderer to indicate that a same document navigation
261 // committed in the renderer process.
262 DidCommitSameDocumentNavigation(
263 DidCommitProvisionalLoadParams params);
264
Arthur Hemery7b67a972017-12-01 15:24:49265 // Sent by the renderer to request a navigation.
266 BeginNavigation(
267 CommonNavigationParams common_params,
268 BeginNavigationParams begin_params);
John Abd-El-Malekd4882642017-12-04 21:45:19269
270 // Sent when a subresource response has started.
271 SubresourceResponseStarted(
272 url.mojom.Url url,
273 url.mojom.Url referrer,
274 string method,
275 ResourceType resource_type,
276 string ip,
277 uint32 cert_status);
Luciano Pacheco8def47f2017-12-07 06:52:30278
279 // Sent when the frame changes its window.name.
280 DidChangeName(string name, string unique_name);
281
282 // Sent when the frame starts enforcing an insecure request policy. Sending
283 // this information in DidCommitProvisionalLoad isn't sufficient; this
284 // message is needed because, for example, a document can dynamically insert
285 // a <meta> tag that causes strict mixed content checking to be enforced.
286 //
287 // Argument |policy_bitmap| represents blink::WebInsecureRequestPolicy uint8
288 // bitfield.
289 EnforceInsecureRequestPolicy(uint8 policy_bitmap);
arthursonzogni4b62a5cb2018-01-17 14:14:26290 // Elements of |set| are hashes of hosts to upgrade.
291 EnforceInsecureNavigationsSet(array<uint32> set);
Luciano Pacheco8def47f2017-12-07 06:52:30292
293 // Notifies the browser process that HTTP headers which affect the frame
294 // polices were delivered with the document being loaded into the frame. This
295 // can be either or both of 'Feature-Policy' or 'Content-Security-Policy' (
296 // which can set sandbox flags).
297 //
298 // |parsed_header| is a list of an origin whitelist for each feature in the
299 // policy.
300 DidSetFramePolicyHeaders(
301 blink.mojom.WebSandboxFlags sandbox_flags,
302 array<blink.mojom.ParsedFeaturePolicyDeclaration> parsed_header);
Austin Tankiang10d64832017-12-20 02:43:55303
304 // If a cross-process navigation was started for the initial history load in
305 // this subframe, this tries to cancel it to allow a client redirect to happen
306 // instead.
307 CancelInitialHistoryLoad();
308
309 // Change the encoding name of the page in UI when the page has detected
310 // proper encoding name. Sent for top-level frames.
311 UpdateEncoding(string encoding_name);
Lucas Furukawa Gadanie5d27a362018-02-13 14:26:02312
313 // The FrameRect represents the frame's size and position. The rect is
314 // replicated in the browser so that the browser can correctly set the initial
315 // size of the frame in case of a cross-process navigation.
316 FrameRectsChanged(gfx.mojom.Rect rect);
ben76f52b242016-06-18 05:42:48317};