| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 // IDs are reported in |conflicting_extensions|. NetLog events that shall be | 252 // IDs are reported in |conflicting_extensions|. NetLog events that shall be |
| 253 // reported will be stored in |event_log_entries|. | 253 // reported will be stored in |event_log_entries|. |
| 254 | 254 |
| 255 // Stores in |canceled| whether any extension wanted to cancel the request. | 255 // Stores in |canceled| whether any extension wanted to cancel the request. |
| 256 void MergeCancelOfResponses(const EventResponseDeltas& deltas, | 256 void MergeCancelOfResponses(const EventResponseDeltas& deltas, |
| 257 bool* canceled, | 257 bool* canceled, |
| 258 const net::NetLogWithSource* net_log); | 258 const net::NetLogWithSource* net_log); |
| 259 // Stores in |*new_url| the redirect request of the extension with highest | 259 // Stores in |*new_url| the redirect request of the extension with highest |
| 260 // precedence. Extensions that did not command to redirect the request are | 260 // precedence. Extensions that did not command to redirect the request are |
| 261 // ignored in this logic. | 261 // ignored in this logic. |
| 262 void MergeRedirectUrlOfResponses(const EventResponseDeltas& deltas, | 262 void MergeRedirectUrlOfResponses(const GURL& url, |
| 263 const EventResponseDeltas& deltas, |
| 263 GURL* new_url, | 264 GURL* new_url, |
| 264 extensions::WarningSet* conflicting_extensions, | 265 extensions::WarningSet* conflicting_extensions, |
| 265 const net::NetLogWithSource* net_log); | 266 const net::NetLogWithSource* net_log); |
| 266 // Stores in |*new_url| the redirect request of the extension with highest | 267 // Stores in |*new_url| the redirect request of the extension with highest |
| 267 // precedence. Extensions that did not command to redirect the request are | 268 // precedence. Extensions that did not command to redirect the request are |
| 268 // ignored in this logic. | 269 // ignored in this logic. |
| 269 void MergeOnBeforeRequestResponses( | 270 void MergeOnBeforeRequestResponses( |
| 271 const GURL& url, |
| 270 const EventResponseDeltas& deltas, | 272 const EventResponseDeltas& deltas, |
| 271 GURL* new_url, | 273 GURL* new_url, |
| 272 extensions::WarningSet* conflicting_extensions, | 274 extensions::WarningSet* conflicting_extensions, |
| 273 const net::NetLogWithSource* net_log); | 275 const net::NetLogWithSource* net_log); |
| 274 // Modifies the "Cookie" header in |request_headers| according to | 276 // Modifies the "Cookie" header in |request_headers| according to |
| 275 // |deltas.request_cookie_modifications|. Conflicts are currently ignored | 277 // |deltas.request_cookie_modifications|. Conflicts are currently ignored |
| 276 // silently. | 278 // silently. |
| 277 void MergeCookiesInOnBeforeSendHeadersResponses( | 279 void MergeCookiesInOnBeforeSendHeadersResponses( |
| 278 const EventResponseDeltas& deltas, | 280 const EventResponseDeltas& deltas, |
| 279 net::HttpRequestHeaders* request_headers, | 281 net::HttpRequestHeaders* request_headers, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 296 scoped_refptr<net::HttpResponseHeaders>* override_response_headers, | 298 scoped_refptr<net::HttpResponseHeaders>* override_response_headers, |
| 297 extensions::WarningSet* conflicting_extensions, | 299 extensions::WarningSet* conflicting_extensions, |
| 298 const net::NetLogWithSource* net_log); | 300 const net::NetLogWithSource* net_log); |
| 299 // Stores a copy of |original_response_header| into |override_response_headers| | 301 // Stores a copy of |original_response_header| into |override_response_headers| |
| 300 // that is modified according to |deltas|. If |deltas| does not instruct to | 302 // that is modified according to |deltas|. If |deltas| does not instruct to |
| 301 // modify the response headers, |override_response_headers| remains empty. | 303 // modify the response headers, |override_response_headers| remains empty. |
| 302 // Extension-initiated redirects are written to |override_response_headers| | 304 // Extension-initiated redirects are written to |override_response_headers| |
| 303 // (to request redirection) and |*allowed_unsafe_redirect_url| (to make sure | 305 // (to request redirection) and |*allowed_unsafe_redirect_url| (to make sure |
| 304 // that the request is not cancelled with net::ERR_UNSAFE_REDIRECT). | 306 // that the request is not cancelled with net::ERR_UNSAFE_REDIRECT). |
| 305 void MergeOnHeadersReceivedResponses( | 307 void MergeOnHeadersReceivedResponses( |
| 308 const GURL& url, |
| 306 const EventResponseDeltas& deltas, | 309 const EventResponseDeltas& deltas, |
| 307 const net::HttpResponseHeaders* original_response_headers, | 310 const net::HttpResponseHeaders* original_response_headers, |
| 308 scoped_refptr<net::HttpResponseHeaders>* override_response_headers, | 311 scoped_refptr<net::HttpResponseHeaders>* override_response_headers, |
| 309 GURL* allowed_unsafe_redirect_url, | 312 GURL* allowed_unsafe_redirect_url, |
| 310 extensions::WarningSet* conflicting_extensions, | 313 extensions::WarningSet* conflicting_extensions, |
| 311 const net::NetLogWithSource* net_log); | 314 const net::NetLogWithSource* net_log); |
| 312 // Merge the responses of blocked onAuthRequired handlers. The first | 315 // Merge the responses of blocked onAuthRequired handlers. The first |
| 313 // registered listener that supplies authentication credentials in a response, | 316 // registered listener that supplies authentication credentials in a response, |
| 314 // if any, will have its authentication credentials used. |request| must be | 317 // if any, will have its authentication credentials used. |request| must be |
| 315 // non-NULL, and contain |deltas| that are sorted in decreasing order of | 318 // non-NULL, and contain |deltas| that are sorted in decreasing order of |
| (...skipping 24 matching lines...) Expand all Loading... |
| 340 | 343 |
| 341 // Stores an |extension::ResourceTypeExt| representation in |types| if | 344 // Stores an |extension::ResourceTypeExt| representation in |types| if |
| 342 // |type_str| is a resource type handled by the web request API. Returns true in | 345 // |type_str| is a resource type handled by the web request API. Returns true in |
| 343 // case of success. | 346 // case of success. |
| 344 bool ParseResourceType(const std::string& type_str, | 347 bool ParseResourceType(const std::string& type_str, |
| 345 std::vector<extensions::ResourceTypeExt>* types); | 348 std::vector<extensions::ResourceTypeExt>* types); |
| 346 | 349 |
| 347 } // namespace extension_web_request_api_helpers | 350 } // namespace extension_web_request_api_helpers |
| 348 | 351 |
| 349 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ | 352 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ |
| OLD | NEW |