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