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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 // given |browser_context_id| to collect UMA statistics on Page Load Times. | 335 // given |browser_context_id| to collect UMA statistics on Page Load Times. |
336 // Needs to be called on the UI thread. | 336 // Needs to be called on the UI thread. |
337 void NotifyWebRequestAPIUsed(void* browser_context_id, | 337 void NotifyWebRequestAPIUsed(void* browser_context_id, |
338 const std::string& extension_id); | 338 const std::string& extension_id); |
339 | 339 |
340 // Send updates to |host| with information about what webRequest-related | 340 // Send updates to |host| with information about what webRequest-related |
341 // extensions are installed. | 341 // extensions are installed. |
342 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host); | 342 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host); |
343 | 343 |
344 // Converts the |name|, |value| pair of a http header to a HttpHeaders | 344 // Converts the |name|, |value| pair of a http header to a HttpHeaders |
345 // dictionary. Ownership is passed to the caller. | 345 // dictionary. |
346 base::DictionaryValue* CreateHeaderDictionary( | 346 std::unique_ptr<base::DictionaryValue> CreateHeaderDictionary( |
347 const std::string& name, const std::string& value); | 347 const std::string& name, |
| 348 const std::string& value); |
348 | 349 |
349 // Returns whether |type| is a ResourceType that is handled by the web request | 350 // Returns whether |type| is a ResourceType that is handled by the web request |
350 // API. | 351 // API. |
351 bool IsRelevantResourceType(content::ResourceType type); | 352 bool IsRelevantResourceType(content::ResourceType type); |
352 | 353 |
353 // Returns a string representation of |type| or |other| if |type| is not handled | 354 // Returns a string representation of |type| or |other| if |type| is not handled |
354 // by the web request API. | 355 // by the web request API. |
355 const char* ResourceTypeToString(content::ResourceType type); | 356 const char* ResourceTypeToString(content::ResourceType type); |
356 | 357 |
357 // Stores a |content::ResourceType| representation in |types| if |type_str| is | 358 // 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 | 359 // a resource type handled by the web request API. Returns true in case of |
359 // success. | 360 // success. |
360 bool ParseResourceType(const std::string& type_str, | 361 bool ParseResourceType(const std::string& type_str, |
361 std::vector<content::ResourceType>* types); | 362 std::vector<content::ResourceType>* types); |
362 | 363 |
363 } // namespace extension_web_request_api_helpers | 364 } // namespace extension_web_request_api_helpers |
364 | 365 |
365 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ | 366 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ |
OLD | NEW |