OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 |
| 7 import "url/mojo/origin.mojom"; |
| 8 import "url/mojo/url.mojom"; |
| 9 |
| 10 enum ReferrerPolicy { |
| 11 Always, |
| 12 Default, |
| 13 NoReferrerWhenDowngrade, |
| 14 Never, |
| 15 Origin, |
| 16 OriginWhenCrossOrigin, |
| 17 NoReferrerWhenDowngradeOriginWhenCrossOrigin, |
| 18 Last = NoReferrerWhenDowngradeOriginWhenCrossOrigin, |
| 19 }; |
| 20 |
| 21 enum ServiceWorkerResponseType { |
| 22 Basic, |
| 23 CORS, |
| 24 Default, |
| 25 Error, |
| 26 Opaque, |
| 27 OpaqueRedirect, |
| 28 Last = OpaqueRedirect, |
| 29 }; |
| 30 |
| 31 struct URLRequest { |
| 32 // The request method: GET, POST, etc. |
| 33 string method; |
| 34 |
| 35 // The requested URL. |
| 36 url.mojom.Url url; |
| 37 |
| 38 // Usually the URL of the document in the top-level window, which may be |
| 39 // checked by the third-party cookie blocking policy. Leaving it empty may |
| 40 // lead to undesired cookie blocking. Third-party cookie blocking can be |
| 41 // bypassed by setting first_party_for_cookies = url, but this should ideally |
| 42 // only be done if there really is no way to determine the correct value. |
| 43 url.mojom.Url first_party_for_cookies; |
| 44 |
| 45 // The origin of the context which initiated the request, which will be used |
| 46 // for cookie checks like 'First-Party-Only'. |
| 47 url.mojom.Origin request_initiator; |
| 48 |
| 49 // The referrer to use (may be empty). |
| 50 url.mojom.Url referrer; |
| 51 |
| 52 // The referrer policy to use. |
| 53 ReferrerPolicy referrer_policy; |
| 54 |
| 55 // TODO(yhirano): Add more members from ResourceMsg_Request. |
| 56 |
| 57 // These are needed for compatibility with the existing ChromeIPC. |
| 58 int32 request_id; |
| 59 int32 routing_id; |
| 60 }; |
| 61 |
| 62 struct URLResponse { |
| 63 // TimeTicks::Now() when the browser received the request from the renderer. |
| 64 int64 request_start; |
| 65 // TimeTicks::Now() when the browser sent the response to the renderer. |
| 66 int64 response_start; |
| 67 |
| 68 // The time at which the request was made that resulted in this response. |
| 69 // For cached responses, this time could be "far" in the past. |
| 70 int64 request_time; |
| 71 |
| 72 // The time at which the response headers were received. For cached responses, |
| 73 // this time could be "far" in the past. |
| 74 int64 response_time; |
| 75 |
| 76 // The HTTP response headers. |
| 77 string? headers; |
| 78 |
| 79 // The HTTP response body. |
| 80 handle<data_pipe_consumer>? body; |
| 81 |
| 82 // The MIME type of the response body. |
| 83 string mime_type; |
| 84 |
| 85 // The character set of the response body. |
| 86 string charset; |
| 87 |
| 88 // An opaque string carrying security information pertaining to this |
| 89 // response. This may include information about the SSL connection used. |
| 90 string security_info; |
| 91 |
| 92 // True if the resource was loaded in spite of certificate errors. |
| 93 bool has_major_certificate_errors; |
| 94 |
| 95 // Content length if available. |
| 96 int64 content_length; |
| 97 |
| 98 // Length of the encoded data transferred over the network. |
| 99 int64 encoded_data_length; |
| 100 |
| 101 // The appcache this response was loaded from. |
| 102 int64 appcache_id; |
| 103 |
| 104 // The appcache this response was loaded from. |
| 105 url.mojom.Url appcache_manifest_url; |
| 106 |
| 107 // Detailed timing information used by the WebTiming, HAR and Developer |
| 108 // Tools. Includes socket ID and socket reuse information. |
| 109 // TODO(yhirano): Add this. |
| 110 // LoadTimingInfo load_timing; |
| 111 |
| 112 // Actual request and response headers, as obtained from the network stack. |
| 113 // Only present if renderer set report_raw_headers to true and had the |
| 114 // CanReadRawCookies permission. |
| 115 // TODO(yhirano): Add this. |
| 116 // ResourceDevToolsInfo? devtools_info; |
| 117 |
| 118 // The path to a file that will contain the response body. It may only |
| 119 // contain a portion of the response body at the time that the ResponseInfo |
| 120 // becomes available. |
| 121 // TODO(yhirano): Add this. |
| 122 // base::FilePath download_file_path; |
| 123 |
| 124 // True if the response was delivered using SPDY. |
| 125 bool was_fetched_via_spdy; |
| 126 |
| 127 // True if the response was delivered after NPN is negotiated. |
| 128 bool was_npn_negotiated; |
| 129 |
| 130 // True if response could use alternate protocol. However, browser will |
| 131 // ignore the alternate protocol when spdy is not enable on browser side. |
| 132 bool was_alternate_protocol_available; |
| 133 |
| 134 // Information about the type of connection used to fetch this response. |
| 135 // TODO(yhirano): Add this. |
| 136 // ConnectionInfo connection_info; |
| 137 |
| 138 // True if the response was fetched via an explicit proxy (as opposed to a |
| 139 // transparent proxy). The proxy could be any type of proxy, HTTP or SOCKS. |
| 140 // Note: we cannot tell if a transparent proxy may have been involved. If |
| 141 // true, |proxy_server| contains the name of the proxy server that was used. |
| 142 bool was_fetched_via_proxy; |
| 143 |
| 144 // TODO(yhirano): Add this. |
| 145 // net::HostPortPair proxy_server; |
| 146 |
| 147 // NPN protocol negotiated with the server. |
| 148 string npn_negotiated_protocol; |
| 149 |
| 150 // Remote address of the socket which fetched this resource. |
| 151 // TODO(yhirano): Add this. |
| 152 // net::HostPortPair socket_address; |
| 153 |
| 154 // True if the response was fetched by a ServiceWorker. |
| 155 bool was_fetched_via_service_worker; |
| 156 |
| 157 // True when the request whoes mode is |CORS| or |CORS-with-forced-preflight| |
| 158 // is sent to a ServiceWorker but FetchEvent.respondWith is not called. So the |
| 159 // renderer have to resend the request with skip service worker flag |
| 160 // considering the CORS preflight logic. |
| 161 bool was_fallback_required_by_service_worker; |
| 162 |
| 163 // The original URL of the response which was fetched by the ServiceWorker. |
| 164 // This may be empty if the response was created inside the ServiceWorker. |
| 165 url.mojom.Url original_url_via_service_worker; |
| 166 |
| 167 // The type of the response which was fetched by the ServiceWorker. |
| 168 ServiceWorkerResponseType response_type_via_service_worker; |
| 169 |
| 170 // The time immediately before starting ServiceWorker. If the response is not |
| 171 // provided by the ServiceWorker, kept empty. |
| 172 // TODO(ksakamoto): Move this to net::LoadTimingInfo. |
| 173 int64 service_worker_start_time; |
| 174 |
| 175 // The time immediately before dispatching fetch event in ServiceWorker. |
| 176 // If the response is not provided by the ServiceWorker, kept empty. |
| 177 // TODO(ksakamoto): Move this to net::LoadTimingInfo. |
| 178 int64 service_worker_ready_time; |
| 179 |
| 180 // True when the response is served from the CacheStorage via the |
| 181 // ServiceWorker. |
| 182 bool is_in_cache_storage; |
| 183 |
| 184 // The cache name of the CacheStorage from where the response is served via |
| 185 // the ServiceWorker. Empty if the response isn't from the CacheStorage. |
| 186 string cache_storage_cache_name; |
| 187 |
| 188 // Whether or not the request was for a LoFi version of the resource. |
| 189 bool is_using_lofi; |
| 190 }; |
| 191 |
| 192 struct URLLoaderStatus { |
| 193 // The error code. |
| 194 int32 network_error; |
| 195 |
| 196 // True when the request was ignored by the request handler. |
| 197 bool was_ignored_by_handler; |
| 198 |
| 199 // True when the resource for the request exists in the cache. |
| 200 bool exists_in_cache; |
| 201 |
| 202 // Serialized securify info; see content/common/ssl_status_serialization.h. |
| 203 string security_info; |
| 204 |
| 205 // Time the request completed. |
| 206 int64 completion_time; |
| 207 |
| 208 // Total amount of data received from the network. |
| 209 int64 encoded_data_length; |
| 210 }; |
| 211 |
| 212 interface URLLoader { |
| 213 // Loads the given |request|, asynchronously producing |response|. Consult |
| 214 // |response| to determine if the request resulted in an error, was |
| 215 // redirected, or has a response body to be consumed. |
| 216 Load(URLRequest request, URLLoaderClient client); |
| 217 |
| 218 // If the request passed to |Load| had |auto_follow_redirects| set to false, |
| 219 // then upon receiving an URLResponse with a non-NULL |redirect_url| field, |
| 220 // |FollowRedirect| may be called to load the URL indicated by the redirect. |
| 221 FollowRedirect(); |
| 222 |
| 223 // Cancels the request. |
| 224 Cancel(); |
| 225 }; |
| 226 |
| 227 interface URLLoaderClient { |
| 228 OnReceiveResponse(URLResponse response); |
| 229 OnComplete(URLLoaderStatus completion_status); |
| 230 }; |
| 231 |
OLD | NEW |