| 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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 // Returns whether authentication credentials are set. | 322 // Returns whether authentication credentials are set. |
| 323 bool MergeOnAuthRequiredResponses( | 323 bool MergeOnAuthRequiredResponses( |
| 324 const EventResponseDeltas& deltas, | 324 const EventResponseDeltas& deltas, |
| 325 net::AuthCredentials* auth_credentials, | 325 net::AuthCredentials* auth_credentials, |
| 326 extensions::WarningSet* conflicting_extensions, | 326 extensions::WarningSet* conflicting_extensions, |
| 327 const net::NetLogWithSource* net_log); | 327 const net::NetLogWithSource* net_log); |
| 328 | 328 |
| 329 // Triggers clearing each renderer's in-memory cache the next time it navigates. | 329 // Triggers clearing each renderer's in-memory cache the next time it navigates. |
| 330 void ClearCacheOnNavigation(); | 330 void ClearCacheOnNavigation(); |
| 331 | 331 |
| 332 // Tells renderer processes that the web request or declarative web request | |
| 333 // API has been used by the extension with the given |extension_id| in the | |
| 334 // given |browser_context_id| to collect UMA statistics on Page Load Times. | |
| 335 // Needs to be called on the UI thread. | |
| 336 void NotifyWebRequestAPIUsed(void* browser_context_id, | |
| 337 const std::string& extension_id); | |
| 338 | |
| 339 // Send updates to |host| with information about what webRequest-related | |
| 340 // extensions are installed. | |
| 341 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host); | |
| 342 | |
| 343 // Converts the |name|, |value| pair of a http header to a HttpHeaders | 332 // Converts the |name|, |value| pair of a http header to a HttpHeaders |
| 344 // dictionary. | 333 // dictionary. |
| 345 std::unique_ptr<base::DictionaryValue> CreateHeaderDictionary( | 334 std::unique_ptr<base::DictionaryValue> CreateHeaderDictionary( |
| 346 const std::string& name, | 335 const std::string& name, |
| 347 const std::string& value); | 336 const std::string& value); |
| 348 | 337 |
| 349 // Returns whether |type| is a ResourceType that is handled by the web request | 338 // Returns whether |type| is a ResourceType that is handled by the web request |
| 350 // API. | 339 // API. |
| 351 bool IsRelevantResourceType(content::ResourceType type); | 340 bool IsRelevantResourceType(content::ResourceType type); |
| 352 | 341 |
| 353 // Returns a string representation of |type| or |other| if |type| is not handled | 342 // Returns a string representation of |type| or |other| if |type| is not handled |
| 354 // by the web request API. | 343 // by the web request API. |
| 355 const char* ResourceTypeToString(content::ResourceType type); | 344 const char* ResourceTypeToString(content::ResourceType type); |
| 356 | 345 |
| 357 // Stores a |content::ResourceType| representation in |types| if |type_str| is | 346 // Stores a |content::ResourceType| representation in |types| if |type_str| is |
| 358 // a resource type handled by the web request API. Returns true in case of | 347 // a resource type handled by the web request API. Returns true in case of |
| 359 // success. | 348 // success. |
| 360 bool ParseResourceType(const std::string& type_str, | 349 bool ParseResourceType(const std::string& type_str, |
| 361 std::vector<content::ResourceType>* types); | 350 std::vector<content::ResourceType>* types); |
| 362 | 351 |
| 363 } // namespace extension_web_request_api_helpers | 352 } // namespace extension_web_request_api_helpers |
| 364 | 353 |
| 365 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ | 354 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ |
| OLD | NEW |