ben | 76f52b24 | 2016-06-18 05:42:48 | [diff] [blame] | 1 | // 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 | |
| 5 | module content.mojom; |
| 6 | |
Arthur Hemery | 7b67a97 | 2017-12-01 15:24:49 | [diff] [blame] | 7 | import "content/common/navigation_params.mojom"; |
Kinuko Yasuda | ba38408 | 2018-01-11 08:30:16 | [diff] [blame] | 8 | import "content/common/service_worker/controller_service_worker.mojom"; |
Ken Rockot | be87ab32 | 2017-11-02 19:40:23 | [diff] [blame] | 9 | import "content/common/url_loader_factory_bundle.mojom"; |
John Abd-El-Malek | d488264 | 2017-12-04 21:45:19 | [diff] [blame] | 10 | import "content/public/common/resource_type.mojom"; |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame] | 11 | import "content/public/common/window_container_type.mojom"; |
Pavel Feldman | 08beed784 | 2017-10-17 19:18:11 | [diff] [blame] | 12 | import "mojo/common/unguessable_token.mojom"; |
Ken Rockot | 8b447d7 | 2018-02-03 20:30:47 | [diff] [blame] | 13 | import "mojo/public/mojom/base/string16.mojom"; |
John Abd-El-Malek | b165dc5 | 2018-01-18 17:12:18 | [diff] [blame] | 14 | import "services/network/public/interfaces/url_loader.mojom"; |
Ken Rockot | 543f5e3 | 2018-02-04 02:13:50 | [diff] [blame] | 15 | import "services/service_manager/public/mojom/interface_provider.mojom"; |
Luciano Pacheco | 8def47f | 2017-12-07 06:52:30 | [diff] [blame] | 16 | import "third_party/WebKit/common/feature_policy/feature_policy.mojom"; |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame] | 17 | import "third_party/WebKit/public/platform/referrer.mojom"; |
| 18 | import "third_party/WebKit/public/web/window_features.mojom"; |
| 19 | import "ui/base/mojo/window_open_disposition.mojom"; |
Daniel Cheng | 7a059b0 | 2018-02-03 10:04:13 | [diff] [blame] | 20 | import "url/mojom/url.mojom"; |
Luciano Pacheco | 8528c16f | 2017-12-14 07:10:56 | [diff] [blame] | 21 | import "ui/gfx/geometry/mojo/geometry.mojom"; |
ben | 76f52b24 | 2016-06-18 05:42:48 | [diff] [blame] | 22 | |
ben | 275a565 | 2016-10-28 16:55:50 | [diff] [blame] | 23 | // The name of the InterfaceProviderSpec in service manifests used by the |
| 24 | // frame tree to expose frame-specific interfaces between renderer and browser. |
| 25 | const string kNavigation_FrameSpec = "navigation:frame"; |
| 26 | |
ben | 76f52b24 | 2016-06-18 05:42:48 | [diff] [blame] | 27 | // Implemented by the frame provider (e.g. renderer processes). |
| 28 | interface Frame { |
rockot | 400ea35b | 2016-10-15 19:15:32 | [diff] [blame] | 29 | GetInterfaceProvider(service_manager.mojom.InterfaceProvider& interfaces); |
Daniel Cheng | 118f9e28 | 2017-11-10 03:28:44 | [diff] [blame] | 30 | GetCanonicalUrlForSharing() => (url.mojom.Url? canonical_url); |
Luciano Pacheco | 8528c16f | 2017-12-14 07:10:56 | [diff] [blame] | 31 | |
| 32 | // Samsung Galaxy Note-specific "smart clip" stylus text getter. |
| 33 | // Extracts the data at the given rect. |
| 34 | // TODO(crbug.com/676224): Only enable for OS_ANDROID. |
| 35 | ExtractSmartClipData(gfx.mojom.Rect rect) |
Ken Rockot | 8b447d7 | 2018-02-03 20:30:47 | [diff] [blame] | 36 | => (mojo_base.mojom.String16 text, mojo_base.mojom.String16 html); |
ben | 76f52b24 | 2016-06-18 05:42:48 | [diff] [blame] | 37 | }; |
| 38 | |
Ken Rockot | 4878545 | 2017-10-25 19:33:14 | [diff] [blame] | 39 | // See src/content/common/navigation_params.h |
| 40 | [Native] |
| 41 | struct CommonNavigationParams; |
| 42 | |
| 43 | // See src/content/common/navigation_params.h |
| 44 | [Native] |
| 45 | struct RequestNavigationParams; |
| 46 | |
| 47 | // Implemented by the frame provider and currently must be associated with the |
| 48 | // legacy IPC channel. |
| 49 | interface FrameNavigationControl { |
arthursonzogni | 3a4ca9f | 2017-12-07 17:58:34 | [diff] [blame] | 50 | // Tells the renderer that a navigation is ready to commit. |
| 51 | // |
| 52 | // The renderer should request |body_url| to get access to the stream |
| 53 | // containing the body of the response. When the Network Service or |
| 54 | // NavigationMojoResponse is enabled, |body_url| is not used and instead |
| 55 | // |url_loader_client_endpoints| provides a way to continue the navigation. |
| 56 | // |
| 57 | // Note: |body_url| and |url_loader_client_endpoints| will be empty iff the |
| 58 | // navigation URL wasn't handled by the network stack (i.e. JavaScript URLs, |
| 59 | // renderer debug URLs, same document navigations, about:blank, ...) |
| 60 | // |
| 61 | // When the Network Service is enabled, |subresource_loader_factories| may |
| 62 | // also be provided by the browser as a a means for the renderer to load |
| 63 | // subresources where applicable. |
Pavel Feldman | f20fc9d | 2017-11-17 09:13:30 | [diff] [blame] | 64 | // |
Kinuko Yasuda | ba38408 | 2018-01-11 08:30:16 | [diff] [blame] | 65 | // When S13nServiceWorker is enabled, |controller_service_worker_info| may |
| 66 | // also be provided by the browser if the frame that is being navigated |
| 67 | // is supposed to be controlled by a Service Worker. |
| 68 | // |
Pavel Feldman | f20fc9d | 2017-11-17 09:13:30 | [diff] [blame] | 69 | // For automation driver-initiated navigations over the devtools protocol, |
| 70 | // |devtools_navigation_token_| is used to tag the navigation. This navigation |
| 71 | // token is then sent into the renderer and lands on the DocumentLoader. That |
| 72 | // way subsequent Blink-level frame lifecycle events can be associated with |
| 73 | // the concrete navigation. |
| 74 | // - The value should not be sent back to the browser. |
| 75 | // - The value on DocumentLoader may be generated in the renderer in some |
| 76 | // cases, and thus shouldn't be trusted. |
| 77 | // TODO(crbug.com/783506): Replace devtools navigation token with the generic |
| 78 | // navigation token that can be passed from renderer to the browser. |
arthursonzogni | 3a4ca9f | 2017-12-07 17:58:34 | [diff] [blame] | 79 | CommitNavigation( |
John Abd-El-Malek | b165dc5 | 2018-01-18 17:12:18 | [diff] [blame] | 80 | network.mojom.URLResponseHead head, |
arthursonzogni | 3a4ca9f | 2017-12-07 17:58:34 | [diff] [blame] | 81 | url.mojom.Url body_url, |
| 82 | CommonNavigationParams common_params, |
| 83 | RequestNavigationParams request_params, |
John Abd-El-Malek | b165dc5 | 2018-01-18 17:12:18 | [diff] [blame] | 84 | network.mojom.URLLoaderClientEndpoints? url_loader_client_endpoints, |
arthursonzogni | 3a4ca9f | 2017-12-07 17:58:34 | [diff] [blame] | 85 | URLLoaderFactoryBundle? subresource_loader_factories, |
Kinuko Yasuda | ba38408 | 2018-01-11 08:30:16 | [diff] [blame] | 86 | ControllerServiceWorkerInfo? controller_service_worker_info, |
arthursonzogni | 3a4ca9f | 2017-12-07 17:58:34 | [diff] [blame] | 87 | mojo.common.mojom.UnguessableToken devtools_navigation_token); |
Doug Turner | 84693be | 2017-12-19 00:18:46 | [diff] [blame] | 88 | |
| 89 | // Tells the renderer that a failed navigation is ready to commit. |
| 90 | // |
| 91 | // The result of this commit usually results in displaying an error page. |
| 92 | // Note |error_page_content| may contain the content of the error page |
| 93 | // (i.e. flattened HTML, JS, CSS). |
| 94 | // |
| 95 | // When the Network Service is enabled, |subresource_loader_factories| may |
| 96 | // also be provided by the browser as a a means for the renderer to load |
| 97 | // subresources where applicable. |
| 98 | CommitFailedNavigation( |
| 99 | CommonNavigationParams common_params, |
| 100 | RequestNavigationParams request_params, |
| 101 | bool has_stale_copy_in_cache, |
| 102 | int32 error_code, |
| 103 | string? error_page_content, |
| 104 | URLLoaderFactoryBundle? subresource_loader_factories); |
Chong Zhang | 7306b0b | 2018-01-24 05:59:24 | [diff] [blame] | 105 | |
clamy | b1df7b96 | 2018-02-01 17:38:17 | [diff] [blame] | 106 | // Asks the renderer to handle a renderer-debug URL. |
| 107 | HandleRendererDebugURL(url.mojom.Url url); |
| 108 | |
Chong Zhang | 7306b0b | 2018-01-24 05:59:24 | [diff] [blame] | 109 | // Provides the renderer an updated |subresource_loader_factories|. |
| 110 | // |
| 111 | // This method is intended to fix broken loaders after a Network Service |
| 112 | // crash, and is only used when Network Service is enabled. |
| 113 | // |
| 114 | // The new bundle contains replacement factories for a subset of the |
| 115 | // receiver's existing bundle. |
| 116 | UpdateSubresourceLoaderFactories( |
| 117 | URLLoaderFactoryBundle subresource_loader_factories); |
Ken Rockot | 4878545 | 2017-10-25 19:33:14 | [diff] [blame] | 118 | }; |
| 119 | |
sammc | 7f6c6a0 | 2017-01-30 00:53:51 | [diff] [blame] | 120 | // Implemented by the frame (e.g. renderer processes). |
| 121 | // Instances of this interface must be associated with (i.e., FIFO with) the |
| 122 | // legacy IPC channel. |
| 123 | interface FrameBindingsControl { |
| 124 | // Used to tell a render frame whether it should expose various bindings |
| 125 | // that allow JS content extended privileges. See BindingsPolicy for valid |
| 126 | // flag values. |
| 127 | AllowBindings(int32 enabled_bindings_flags); |
| 128 | }; |
| 129 | |
ben | 76f52b24 | 2016-06-18 05:42:48 | [diff] [blame] | 130 | // Implemented by a service that provides implementations of the Frame |
| 131 | // interface. (e.g. renderer processes). |
| 132 | interface FrameFactory { |
Balazs Engedy | ba034e7 | 2017-10-27 22:26:28 | [diff] [blame] | 133 | CreateFrame(int32 frame_routing_id, Frame& frame); |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame] | 134 | }; |
| 135 | |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame] | 136 | struct CreateNewWindowParams { |
| 137 | // True if this open request came in the context of a user gesture. |
| 138 | bool user_gesture; |
| 139 | |
| 140 | // Type of window requested. |
| 141 | WindowContainerType window_container_type; |
| 142 | |
| 143 | // The session storage namespace ID this window should use. |
| 144 | int64 session_storage_namespace_id; |
| 145 | |
| 146 | // The name of the resulting frame that should be created (empty if none |
| 147 | // has been specified). UTF8 encoded string. |
| 148 | string frame_name; |
| 149 | |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame] | 150 | // Whether the opener will be suppressed in the new window, in which case |
| 151 | // scripting the new window is not allowed. |
| 152 | bool opener_suppressed; |
| 153 | |
| 154 | // Whether the window should be opened in the foreground, background, etc. |
| 155 | ui.mojom.WindowOpenDisposition disposition; |
| 156 | |
| 157 | // The URL that will be loaded in the new window (empty if none has been |
| 158 | // specified). |
| 159 | url.mojom.Url target_url; |
| 160 | |
| 161 | // The referrer that will be used to load |target_url| (empty if none has |
| 162 | // been specified). |
| 163 | blink.mojom.Referrer referrer; |
| 164 | |
| 165 | // The window features to use for the new window. |
| 166 | blink.mojom.WindowFeatures features; |
| 167 | }; |
| 168 | |
Daniel Cheng | 8bb30c6 | 2017-10-23 20:40:47 | [diff] [blame] | 169 | // Operation result when the renderer asks the browser to create a new window. |
| 170 | enum CreateNewWindowStatus { |
| 171 | // Ignore creation of the new window. This can happen because creation is |
| 172 | // blocked or because the new window should have no opener relationship. |
| 173 | kIgnore, |
| 174 | // Reuse the current window rather than creating a new window. |
| 175 | kReuse, |
| 176 | // Create a new window using the corresponding params in |reply|. |
| 177 | kSuccess, |
| 178 | }; |
| 179 | |
| 180 | // All routing IDs in this struct must be set to a valid routing ID. |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame] | 181 | struct CreateNewWindowReply { |
Daniel Cheng | 8bb30c6 | 2017-10-23 20:40:47 | [diff] [blame] | 182 | // The ID of the view to be created. |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame] | 183 | int32 route_id; |
| 184 | |
| 185 | // The ID of the main frame hosted in the view. |
| 186 | int32 main_frame_route_id; |
| 187 | |
| 188 | // The ID of the widget for the main frame. |
| 189 | int32 main_frame_widget_route_id; |
| 190 | |
Balazs Engedy | ba034e7 | 2017-10-27 22:26:28 | [diff] [blame] | 191 | // The InterfaceProvider through which the main RenderFrame can access |
| 192 | // services exposed by its RenderFrameHost. |
| 193 | service_manager.mojom.InterfaceProvider main_frame_interface_provider; |
| 194 | |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame] | 195 | // Duplicated from CreateNewWindowParams because legacy code. |
| 196 | int64 cloned_session_storage_namespace_id; |
Pavel Feldman | 08beed784 | 2017-10-17 19:18:11 | [diff] [blame] | 197 | |
| 198 | // Used for devtools instrumentation and trace-ability. The token is |
| 199 | // propagated to Blink's LocalFrame and both Blink and content/ |
| 200 | // can tag calls and requests with this instrumentation token in order to |
| 201 | // attribute them to the context frame. |
| 202 | // |devtools_frame_token| is only defined by the browser and is never |
| 203 | // sent back from the renderer in the control calls. |
| 204 | mojo.common.mojom.UnguessableToken devtools_main_frame_token; |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame] | 205 | }; |
| 206 | |
Yutaka Hirano | f7f2f63 | 2017-09-06 10:40:08 | [diff] [blame] | 207 | // An opaque handle that keeps alive the associated render process even after |
| 208 | // the frame is detached. Used by resource requests with "keepalive" specified. |
| 209 | interface KeepAliveHandle {}; |
| 210 | |
Balazs Engedy | a40712f | 2017-09-15 15:01:11 | [diff] [blame] | 211 | [Native] |
| 212 | struct DidCommitProvisionalLoadParams; |
| 213 | |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame] | 214 | // Implemented by the frame server (i.e. the browser process). For messages that |
| 215 | // must be associated with the IPC channel. |
| 216 | interface FrameHost { |
Daniel Cheng | 8bb30c6 | 2017-10-23 20:40:47 | [diff] [blame] | 217 | // Sent by the renderer to request the browser to create a new window. |reply| |
| 218 | // is only non-null on when status == CreateNewWindowStatus::kSuccess. |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame] | 219 | [Sync] CreateNewWindow(CreateNewWindowParams params) |
Daniel Cheng | 8bb30c6 | 2017-10-23 20:40:47 | [diff] [blame] | 220 | => (CreateNewWindowStatus status, CreateNewWindowReply? reply); |
Yutaka Hirano | f7f2f63 | 2017-09-06 10:40:08 | [diff] [blame] | 221 | |
| 222 | // Creates and returns a KeepAliveHandle. |
| 223 | IssueKeepAliveHandle(KeepAliveHandle& keep_alive_handle); |
Balazs Engedy | a40712f | 2017-09-15 15:01:11 | [diff] [blame] | 224 | |
| 225 | // Sent by the renderer when a navigation commits in the frame. |
Balazs Engedy | 0c8d550b | 2017-12-06 21:30:23 | [diff] [blame] | 226 | // |
| 227 | // If |interface_provider_request| is non-empty, the FrameHost implementation |
| 228 | // must unbind the old InterfaceProvider connection, and drop any interface |
| 229 | // requests pending on it. Then it should bind |interface_provider_request| |
| 230 | // and start servicing GetInterface messages coming in on this new connection |
| 231 | // in a security context that is appropriate for the committed navigation. |
| 232 | // |
| 233 | // The FrameHost implementation must enforce that |interface_provider_request| |
| 234 | // is set for cross-document navigations. This prevents origin confusion by |
| 235 | // ensuring that interface requests racing with navigation commit will be |
| 236 | // either ignored, or serviced correctly in the security context of the |
| 237 | // document they originated from (based on which InterfaceProvider connection |
| 238 | // the GetInterface messages arrive on). |
Balazs Engedy | a40712f | 2017-09-15 15:01:11 | [diff] [blame] | 239 | DidCommitProvisionalLoad( |
Balazs Engedy | 0c8d550b | 2017-12-06 21:30:23 | [diff] [blame] | 240 | DidCommitProvisionalLoadParams params, |
| 241 | service_manager.mojom.InterfaceProvider&? interface_provider_request); |
Arthur Hemery | 7b67a97 | 2017-12-01 15:24:49 | [diff] [blame] | 242 | |
Arthur Hemery | 7b0ae49 | 2018-02-05 16:04:45 | [diff] [blame^] | 243 | // Sent by the renderer to indicate that a same document navigation |
| 244 | // committed in the renderer process. |
| 245 | DidCommitSameDocumentNavigation( |
| 246 | DidCommitProvisionalLoadParams params); |
| 247 | |
Arthur Hemery | 7b67a97 | 2017-12-01 15:24:49 | [diff] [blame] | 248 | // Sent by the renderer to request a navigation. |
| 249 | BeginNavigation( |
| 250 | CommonNavigationParams common_params, |
| 251 | BeginNavigationParams begin_params); |
John Abd-El-Malek | d488264 | 2017-12-04 21:45:19 | [diff] [blame] | 252 | |
| 253 | // Sent when a subresource response has started. |
| 254 | SubresourceResponseStarted( |
| 255 | url.mojom.Url url, |
| 256 | url.mojom.Url referrer, |
| 257 | string method, |
| 258 | ResourceType resource_type, |
| 259 | string ip, |
| 260 | uint32 cert_status); |
Luciano Pacheco | 8def47f | 2017-12-07 06:52:30 | [diff] [blame] | 261 | |
| 262 | // Sent when the frame changes its window.name. |
| 263 | DidChangeName(string name, string unique_name); |
| 264 | |
| 265 | // Sent when the frame starts enforcing an insecure request policy. Sending |
| 266 | // this information in DidCommitProvisionalLoad isn't sufficient; this |
| 267 | // message is needed because, for example, a document can dynamically insert |
| 268 | // a <meta> tag that causes strict mixed content checking to be enforced. |
| 269 | // |
| 270 | // Argument |policy_bitmap| represents blink::WebInsecureRequestPolicy uint8 |
| 271 | // bitfield. |
| 272 | EnforceInsecureRequestPolicy(uint8 policy_bitmap); |
arthursonzogni | 4b62a5cb | 2018-01-17 14:14:26 | [diff] [blame] | 273 | // Elements of |set| are hashes of hosts to upgrade. |
| 274 | EnforceInsecureNavigationsSet(array<uint32> set); |
Luciano Pacheco | 8def47f | 2017-12-07 06:52:30 | [diff] [blame] | 275 | |
| 276 | // Notifies the browser process that HTTP headers which affect the frame |
| 277 | // polices were delivered with the document being loaded into the frame. This |
| 278 | // can be either or both of 'Feature-Policy' or 'Content-Security-Policy' ( |
| 279 | // which can set sandbox flags). |
| 280 | // |
| 281 | // |parsed_header| is a list of an origin whitelist for each feature in the |
| 282 | // policy. |
| 283 | DidSetFramePolicyHeaders( |
| 284 | blink.mojom.WebSandboxFlags sandbox_flags, |
| 285 | array<blink.mojom.ParsedFeaturePolicyDeclaration> parsed_header); |
Austin Tankiang | 10d6483 | 2017-12-20 02:43:55 | [diff] [blame] | 286 | |
| 287 | // If a cross-process navigation was started for the initial history load in |
| 288 | // this subframe, this tries to cancel it to allow a client redirect to happen |
| 289 | // instead. |
| 290 | CancelInitialHistoryLoad(); |
| 291 | |
| 292 | // Change the encoding name of the page in UI when the page has detected |
| 293 | // proper encoding name. Sent for top-level frames. |
| 294 | UpdateEncoding(string encoding_name); |
ben | 76f52b24 | 2016-06-18 05:42:48 | [diff] [blame] | 295 | }; |