OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Helper classes and functions used for the WebRequest API. | 5 // Helper classes and functions used for the WebRequest API. |
6 | 6 |
7 #ifndef EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ | 7 #ifndef EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ |
8 #define EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ | 8 #define EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ |
9 | 9 |
10 #include <list> | 10 #include <list> |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 // IDs are reported in |conflicting_extensions|. NetLog events that shall be | 250 // IDs are reported in |conflicting_extensions|. NetLog events that shall be |
251 // reported will be stored in |event_log_entries|. | 251 // reported will be stored in |event_log_entries|. |
252 | 252 |
253 // Stores in |canceled| whether any extension wanted to cancel the request. | 253 // Stores in |canceled| whether any extension wanted to cancel the request. |
254 void MergeCancelOfResponses(const EventResponseDeltas& deltas, | 254 void MergeCancelOfResponses(const EventResponseDeltas& deltas, |
255 bool* canceled, | 255 bool* canceled, |
256 const net::NetLogWithSource* net_log); | 256 const net::NetLogWithSource* net_log); |
257 // Stores in |*new_url| the redirect request of the extension with highest | 257 // Stores in |*new_url| the redirect request of the extension with highest |
258 // precedence. Extensions that did not command to redirect the request are | 258 // precedence. Extensions that did not command to redirect the request are |
259 // ignored in this logic. | 259 // ignored in this logic. |
260 void MergeRedirectUrlOfResponses(const EventResponseDeltas& deltas, | 260 void MergeRedirectUrlOfResponses(const GURL& url, |
| 261 const EventResponseDeltas& deltas, |
261 GURL* new_url, | 262 GURL* new_url, |
262 extensions::WarningSet* conflicting_extensions, | 263 extensions::WarningSet* conflicting_extensions, |
263 const net::NetLogWithSource* net_log); | 264 const net::NetLogWithSource* net_log); |
264 // Stores in |*new_url| the redirect request of the extension with highest | 265 // Stores in |*new_url| the redirect request of the extension with highest |
265 // precedence. Extensions that did not command to redirect the request are | 266 // precedence. Extensions that did not command to redirect the request are |
266 // ignored in this logic. | 267 // ignored in this logic. |
267 void MergeOnBeforeRequestResponses( | 268 void MergeOnBeforeRequestResponses( |
| 269 const GURL& url, |
268 const EventResponseDeltas& deltas, | 270 const EventResponseDeltas& deltas, |
269 GURL* new_url, | 271 GURL* new_url, |
270 extensions::WarningSet* conflicting_extensions, | 272 extensions::WarningSet* conflicting_extensions, |
271 const net::NetLogWithSource* net_log); | 273 const net::NetLogWithSource* net_log); |
272 // Modifies the "Cookie" header in |request_headers| according to | 274 // Modifies the "Cookie" header in |request_headers| according to |
273 // |deltas.request_cookie_modifications|. Conflicts are currently ignored | 275 // |deltas.request_cookie_modifications|. Conflicts are currently ignored |
274 // silently. | 276 // silently. |
275 void MergeCookiesInOnBeforeSendHeadersResponses( | 277 void MergeCookiesInOnBeforeSendHeadersResponses( |
276 const EventResponseDeltas& deltas, | 278 const EventResponseDeltas& deltas, |
277 net::HttpRequestHeaders* request_headers, | 279 net::HttpRequestHeaders* request_headers, |
(...skipping 16 matching lines...) Expand all Loading... |
294 scoped_refptr<net::HttpResponseHeaders>* override_response_headers, | 296 scoped_refptr<net::HttpResponseHeaders>* override_response_headers, |
295 extensions::WarningSet* conflicting_extensions, | 297 extensions::WarningSet* conflicting_extensions, |
296 const net::NetLogWithSource* net_log); | 298 const net::NetLogWithSource* net_log); |
297 // Stores a copy of |original_response_header| into |override_response_headers| | 299 // Stores a copy of |original_response_header| into |override_response_headers| |
298 // that is modified according to |deltas|. If |deltas| does not instruct to | 300 // that is modified according to |deltas|. If |deltas| does not instruct to |
299 // modify the response headers, |override_response_headers| remains empty. | 301 // modify the response headers, |override_response_headers| remains empty. |
300 // Extension-initiated redirects are written to |override_response_headers| | 302 // Extension-initiated redirects are written to |override_response_headers| |
301 // (to request redirection) and |*allowed_unsafe_redirect_url| (to make sure | 303 // (to request redirection) and |*allowed_unsafe_redirect_url| (to make sure |
302 // that the request is not cancelled with net::ERR_UNSAFE_REDIRECT). | 304 // that the request is not cancelled with net::ERR_UNSAFE_REDIRECT). |
303 void MergeOnHeadersReceivedResponses( | 305 void MergeOnHeadersReceivedResponses( |
| 306 const GURL& url, |
304 const EventResponseDeltas& deltas, | 307 const EventResponseDeltas& deltas, |
305 const net::HttpResponseHeaders* original_response_headers, | 308 const net::HttpResponseHeaders* original_response_headers, |
306 scoped_refptr<net::HttpResponseHeaders>* override_response_headers, | 309 scoped_refptr<net::HttpResponseHeaders>* override_response_headers, |
307 GURL* allowed_unsafe_redirect_url, | 310 GURL* allowed_unsafe_redirect_url, |
308 extensions::WarningSet* conflicting_extensions, | 311 extensions::WarningSet* conflicting_extensions, |
309 const net::NetLogWithSource* net_log); | 312 const net::NetLogWithSource* net_log); |
310 // Merge the responses of blocked onAuthRequired handlers. The first | 313 // Merge the responses of blocked onAuthRequired handlers. The first |
311 // registered listener that supplies authentication credentials in a response, | 314 // registered listener that supplies authentication credentials in a response, |
312 // if any, will have its authentication credentials used. |request| must be | 315 // if any, will have its authentication credentials used. |request| must be |
313 // non-NULL, and contain |deltas| that are sorted in decreasing order of | 316 // non-NULL, and contain |deltas| that are sorted in decreasing order of |
(...skipping 10 matching lines...) Expand all Loading... |
324 | 327 |
325 // Converts the |name|, |value| pair of a http header to a HttpHeaders | 328 // Converts the |name|, |value| pair of a http header to a HttpHeaders |
326 // dictionary. | 329 // dictionary. |
327 std::unique_ptr<base::DictionaryValue> CreateHeaderDictionary( | 330 std::unique_ptr<base::DictionaryValue> CreateHeaderDictionary( |
328 const std::string& name, | 331 const std::string& name, |
329 const std::string& value); | 332 const std::string& value); |
330 | 333 |
331 } // namespace extension_web_request_api_helpers | 334 } // namespace extension_web_request_api_helpers |
332 | 335 |
333 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ | 336 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ |
OLD | NEW |