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> |
11 #include <memory> | 11 #include <memory> |
12 #include <set> | 12 #include <set> |
13 #include <string> | 13 #include <string> |
14 | 14 |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/linked_ptr.h" | 16 #include "base/memory/linked_ptr.h" |
17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
19 #include "content/public/common/resource_type.h" | 19 #include "content/public/common/resource_type.h" |
20 #include "extensions/browser/api/web_request/web_request_resource_type.h" | |
20 #include "extensions/browser/warning_set.h" | 21 #include "extensions/browser/warning_set.h" |
21 #include "net/base/auth.h" | 22 #include "net/base/auth.h" |
22 #include "net/http/http_request_headers.h" | 23 #include "net/http/http_request_headers.h" |
23 #include "net/http/http_response_headers.h" | 24 #include "net/http/http_response_headers.h" |
24 #include "url/gurl.h" | 25 #include "url/gurl.h" |
25 | 26 |
26 namespace base { | 27 namespace base { |
27 class ListValue; | 28 class ListValue; |
28 class DictionaryValue; | 29 class DictionaryValue; |
29 } | 30 } |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
322 | 323 |
323 // Triggers clearing each renderer's in-memory cache the next time it navigates. | 324 // Triggers clearing each renderer's in-memory cache the next time it navigates. |
324 void ClearCacheOnNavigation(); | 325 void ClearCacheOnNavigation(); |
325 | 326 |
326 // Converts the |name|, |value| pair of a http header to a HttpHeaders | 327 // Converts the |name|, |value| pair of a http header to a HttpHeaders |
327 // dictionary. | 328 // dictionary. |
328 std::unique_ptr<base::DictionaryValue> CreateHeaderDictionary( | 329 std::unique_ptr<base::DictionaryValue> CreateHeaderDictionary( |
329 const std::string& name, | 330 const std::string& name, |
330 const std::string& value); | 331 const std::string& value); |
331 | 332 |
332 // Returns whether |type| is a ResourceType that is handled by the web request | 333 // Returns whether |type| is a content::ResourceType that is handled by the web |
333 // API. | 334 // request API. |
334 bool IsRelevantResourceType(content::ResourceType type); | 335 bool IsRelevantResourceType(content::ResourceType type); |
335 | 336 |
336 // Returns a string representation of |type| or |other| if |type| is not handled | 337 // Returns a string representation of |type| or |other| if |type| is not handled |
337 // by the web request API. | 338 // by the web request API. |
338 const char* ResourceTypeToString(content::ResourceType type); | 339 const char* ResourceTypeToString(extensions::WebRequestResourceType type); |
339 | 340 |
340 // Stores a |content::ResourceType| representation in |types| if |type_str| is | 341 // Stores an |extension::WebRequestResourceType| representation in |types| if |
Devlin
2017/02/16 15:13:05
nit: s/extension::/extensions::
pkalinnikov
2017/02/16 15:52:45
Done.
| |
341 // a resource type handled by the web request API. Returns true in case of | 342 // |type_str| is a resource type handled by the web request API. Returns true in |
342 // success. | 343 // case of success. |
343 bool ParseResourceType(const std::string& type_str, | 344 bool ParseResourceType(const std::string& type_str, |
344 std::vector<content::ResourceType>* types); | 345 std::vector<extensions::WebRequestResourceType>* types); |
345 | 346 |
346 } // namespace extension_web_request_api_helpers | 347 } // namespace extension_web_request_api_helpers |
347 | 348 |
348 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ | 349 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ |
OLD | NEW |