| 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 CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ | 7 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ |
| 8 #define CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ | 8 #define CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/memory/linked_ptr.h" | 14 #include "base/memory/linked_ptr.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 18 #include "content/public/common/resource_type.h" | |
| 19 #include "extensions/browser/warning_set.h" | 18 #include "extensions/browser/warning_set.h" |
| 20 #include "net/base/auth.h" | 19 #include "net/base/auth.h" |
| 21 #include "net/http/http_request_headers.h" | 20 #include "net/http/http_request_headers.h" |
| 22 #include "net/http/http_response_headers.h" | 21 #include "net/http/http_response_headers.h" |
| 23 #include "url/gurl.h" | 22 #include "url/gurl.h" |
| 24 | 23 |
| 25 namespace base { | 24 namespace base { |
| 26 class ListValue; | 25 class ListValue; |
| 27 class Value; | 26 class Value; |
| 28 } | 27 } |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 // if any, will have its authentication credentials used. |request| must be | 294 // if any, will have its authentication credentials used. |request| must be |
| 296 // non-NULL, and contain |deltas| that are sorted in decreasing order of | 295 // non-NULL, and contain |deltas| that are sorted in decreasing order of |
| 297 // precedence. | 296 // precedence. |
| 298 // Returns whether authentication credentials are set. | 297 // Returns whether authentication credentials are set. |
| 299 bool MergeOnAuthRequiredResponses( | 298 bool MergeOnAuthRequiredResponses( |
| 300 const EventResponseDeltas& deltas, | 299 const EventResponseDeltas& deltas, |
| 301 net::AuthCredentials* auth_credentials, | 300 net::AuthCredentials* auth_credentials, |
| 302 extensions::WarningSet* conflicting_extensions, | 301 extensions::WarningSet* conflicting_extensions, |
| 303 const net::BoundNetLog* net_log); | 302 const net::BoundNetLog* net_log); |
| 304 | 303 |
| 305 // Returns whether |type| is a ResourceType that is handled by the web request | |
| 306 // API. | |
| 307 bool IsRelevantResourceType(content::ResourceType type); | |
| 308 | |
| 309 // Returns a string representation of |type| or |other| if |type| is not handled | |
| 310 // by the web request API. | |
| 311 const char* ResourceTypeToString(content::ResourceType type); | |
| 312 | |
| 313 // Stores a |content::ResourceType| representation in |type| if |type_str| is | |
| 314 // a resource type handled by the web request API. Returns true in case of | |
| 315 // success. | |
| 316 bool ParseResourceType(const std::string& type_str, | |
| 317 content::ResourceType* type); | |
| 318 | |
| 319 // Triggers clearing each renderer's in-memory cache the next time it navigates. | 304 // Triggers clearing each renderer's in-memory cache the next time it navigates. |
| 320 void ClearCacheOnNavigation(); | 305 void ClearCacheOnNavigation(); |
| 321 | 306 |
| 322 // Tells renderer processes that the web request or declarative web request | 307 // Tells renderer processes that the web request or declarative web request |
| 323 // API has been used by |extension| in profile |profile_id| to collect | 308 // API has been used by |extension| in profile |profile_id| to collect |
| 324 // UMA statistics on Page Load Times. Needs to be called on the UI thread. | 309 // UMA statistics on Page Load Times. Needs to be called on the UI thread. |
| 325 void NotifyWebRequestAPIUsed( | 310 void NotifyWebRequestAPIUsed( |
| 326 void* profile_id, | 311 void* profile_id, |
| 327 scoped_refptr<const extensions::Extension> extension); | 312 scoped_refptr<const extensions::Extension> extension); |
| 328 | 313 |
| 329 } // namespace extension_web_request_api_helpers | 314 } // namespace extension_web_request_api_helpers |
| 330 | 315 |
| 331 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ | 316 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ |
| OLD | NEW |