Chromium Code Reviews| Index: content/common/url_loader.mojom |
| diff --git a/content/common/url_loader.mojom b/content/common/url_loader.mojom |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bfe1e962ee82d91cd803d97ef7ba96ac53e0d00f |
| --- /dev/null |
| +++ b/content/common/url_loader.mojom |
| @@ -0,0 +1,228 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +module content.mojom; |
| + |
| +enum ReferrerPolicy { |
| + Always, |
| + Default, |
| + NoReferrerWhenDowngrade, |
| + Never, |
| + Origin, |
| + OriginWhenCrossOrigin, |
| + NoReferrerWhenDowngradeOriginWhenCrossOrigin, |
| + Last = NoReferrerWhenDowngradeOriginWhenCrossOrigin, |
| +}; |
| + |
| +enum ServiceWorkerResponseType { |
| + Basic, |
| + CORS, |
| + Default, |
| + Error, |
| + Opaque, |
| + OpaqueRedirect, |
| + Last = OpaqueRedirect, |
| +}; |
| + |
| +struct URLRequest { |
| + // The request method: GET, POST, etc. |
| + string method; |
| + |
| + // The requested URL. |
| + string url; |
|
dcheng
2016/05/11 17:05:18
Use url.mojom.Url?
yhirano
2016/05/16 14:40:06
Thanks, but I'm now using IPC ParamTraits and we d
|
| + |
| + // Usually the URL of the document in the top-level window, which may be |
| + // checked by the third-party cookie blocking policy. Leaving it empty may |
| + // lead to undesired cookie blocking. Third-party cookie blocking can be |
| + // bypassed by setting first_party_for_cookies = url, but this should ideally |
| + // only be done if there really is no way to determine the correct value. |
| + string first_party_for_cookies; |
| + |
| + // The origin of the context which initiated the request, which will be used |
| + // for cookie checks like 'First-Party-Only'. |
| + string request_initiator; |
| + |
| + // The referrer to use (may be empty). |
| + string referrer; |
| + |
| + // The referrer policy to use. |
| + ReferrerPolicy referrer_policy; |
| + |
| + // TODO(yhirano): Add more members from ResourceMsg_Request. |
| + |
| + // These are needed for compatibility with the existing ChromeIPC. |
| + int32 request_id; |
| + int32 routing_id; |
| +}; |
| + |
| +struct URLResponse { |
| + // TimeTicks::Now() when the browser received the request from the renderer. |
| + int64 request_start; |
| + // TimeTicks::Now() when the browser sent the response to the renderer. |
| + int64 response_start; |
| + |
| + // The time at which the request was made that resulted in this response. |
| + // For cached responses, this time could be "far" in the past. |
| + int64 request_time; |
| + |
| + // The time at which the response headers were received. For cached responses, |
| + // this time could be "far" in the past. |
| + int64 response_time; |
| + |
| + // The HTTP response headers. |
| + string? headers; |
| + |
| + // The HTTP response body. |
| + handle<data_pipe_consumer>? body; |
| + |
| + // The MIME type of the response body. |
| + string mime_type; |
| + |
| + // The character set of the response body. |
| + string charset; |
| + |
| + // An opaque string carrying security information pertaining to this |
| + // response. This may include information about the SSL connection used. |
| + string security_info; |
| + |
| + // True if the resource was loaded in spite of certificate errors. |
| + bool has_major_certificate_errors; |
| + |
| + // Content length if available. |
| + int64 content_length; |
| + |
| + // Length of the encoded data transferred over the network. |
| + int64 encoded_data_length; |
| + |
| + // The appcache this response was loaded from. |
| + int64 appcache_id; |
| + |
| + // The appcache this response was loaded from. |
| + string appcache_manifest_url; |
| + |
| + // Detailed timing information used by the WebTiming, HAR and Developer |
| + // Tools. Includes socket ID and socket reuse information. |
| + // TODO(yhirano): Add this. |
| + // LoadTimingInfo load_timing; |
| + |
| + // Actual request and response headers, as obtained from the network stack. |
| + // Only present if renderer set report_raw_headers to true and had the |
| + // CanReadRawCookies permission. |
| + // TODO(yhirano): Add this. |
| + // ResourceDevToolsInfo? devtools_info; |
| + |
| + // The path to a file that will contain the response body. It may only |
| + // contain a portion of the response body at the time that the ResponseInfo |
| + // becomes available. |
| + // TODO(yhirano): Add this. |
| + // base::FilePath download_file_path; |
| + |
| + // True if the response was delivered using SPDY. |
| + bool was_fetched_via_spdy; |
| + |
| + // True if the response was delivered after NPN is negotiated. |
| + bool was_npn_negotiated; |
| + |
| + // True if response could use alternate protocol. However, browser will |
| + // ignore the alternate protocol when spdy is not enable on browser side. |
| + bool was_alternate_protocol_available; |
| + |
| + // Information about the type of connection used to fetch this response. |
| + // TODO(yhirano): Add this. |
| + // ConnectionInfo connection_info; |
| + |
| + // True if the response was fetched via an explicit proxy (as opposed to a |
| + // transparent proxy). The proxy could be any type of proxy, HTTP or SOCKS. |
| + // Note: we cannot tell if a transparent proxy may have been involved. If |
| + // true, |proxy_server| contains the name of the proxy server that was used. |
| + bool was_fetched_via_proxy; |
| + |
| + // TODO(yhirano): Add this. |
| + // net::HostPortPair proxy_server; |
| + |
| + // NPN protocol negotiated with the server. |
| + string npn_negotiated_protocol; |
| + |
| + // Remote address of the socket which fetched this resource. |
| + // TODO(yhirano): Add this. |
| + // net::HostPortPair socket_address; |
| + |
| + // True if the response was fetched by a ServiceWorker. |
| + bool was_fetched_via_service_worker; |
| + |
| + // True when the request whoes mode is |CORS| or |CORS-with-forced-preflight| |
| + // is sent to a ServiceWorker but FetchEvent.respondWith is not called. So the |
| + // renderer have to resend the request with skip service worker flag |
| + // considering the CORS preflight logic. |
| + bool was_fallback_required_by_service_worker; |
| + |
| + // The original URL of the response which was fetched by the ServiceWorker. |
| + // This may be empty if the response was created inside the ServiceWorker. |
| + string original_url_via_service_worker; |
| + |
| + // The type of the response which was fetched by the ServiceWorker. |
| + ServiceWorkerResponseType response_type_via_service_worker; |
| + |
| + // The time immediately before starting ServiceWorker. If the response is not |
| + // provided by the ServiceWorker, kept empty. |
| + // TODO(ksakamoto): Move this to net::LoadTimingInfo. |
| + int64 service_worker_start_time; |
| + |
| + // The time immediately before dispatching fetch event in ServiceWorker. |
| + // If the response is not provided by the ServiceWorker, kept empty. |
| + // TODO(ksakamoto): Move this to net::LoadTimingInfo. |
| + int64 service_worker_ready_time; |
| + |
| + // True when the response is served from the CacheStorage via the |
| + // ServiceWorker. |
| + bool is_in_cache_storage; |
| + |
| + // The cache name of the CacheStorage from where the response is served via |
| + // the ServiceWorker. Empty if the response isn't from the CacheStorage. |
| + string cache_storage_cache_name; |
| + |
| + // Whether or not the request was for a LoFi version of the resource. |
| + bool is_using_lofi; |
| +}; |
| + |
| +struct URLLoaderStatus { |
| + // The error code. |
| + int32 network_error; |
| + |
| + // True when the request was ignored by the request handler. |
| + bool was_ignored_by_handler; |
| + |
| + // True when the resource for the request exists in the cache. |
| + bool exists_in_cache; |
| + |
| + // Serialized securify info; see content/common/ssl_status_serialization.h. |
| + string security_info; |
| + |
| + // Time the request completed. |
| + int64 completion_time; |
| + |
| + // Total amount of data received from the network. |
| + int64 encoded_data_length; |
| +}; |
| + |
| +interface URLLoader { |
| + // Loads the given |request|, asynchronously producing |response|. Consult |
| + // |response| to determine if the request resulted in an error, was |
| + // redirected, or has a response body to be consumed. |
| + Load(URLRequest request, URLLoaderClient client); |
| + |
| + // If the request passed to |Load| had |auto_follow_redirects| set to false, |
| + // then upon receiving an URLResponse with a non-NULL |redirect_url| field, |
| + // |FollowRedirect| may be called to load the URL indicated by the redirect. |
| + FollowRedirect(); |
| + |
| + // Cancels the request. |
| + Cancel(); |
| +}; |
| + |
| +interface URLLoaderClient { |
| + OnReceiveResponse(URLResponse response); |
| + OnComplete(URLLoaderStatus completion_status); |
| +}; |
| + |