Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: extensions/browser/api/web_request/web_request_api_helpers.h

Issue 2700553002: Introduce WebRequestResourceType. (Closed)
Patch Set: Make compiler happy; make type<->string mapping self-checking. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
20 #include "extensions/browser/warning_set.h" 19 #include "extensions/browser/warning_set.h"
21 #include "net/base/auth.h" 20 #include "net/base/auth.h"
22 #include "net/http/http_request_headers.h" 21 #include "net/http/http_request_headers.h"
23 #include "net/http/http_response_headers.h" 22 #include "net/http/http_response_headers.h"
24 #include "url/gurl.h" 23 #include "url/gurl.h"
25 24
26 namespace base { 25 namespace base {
27 class ListValue; 26 class ListValue;
28 class DictionaryValue; 27 class DictionaryValue;
29 } 28 }
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 321
323 // Triggers clearing each renderer's in-memory cache the next time it navigates. 322 // Triggers clearing each renderer's in-memory cache the next time it navigates.
324 void ClearCacheOnNavigation(); 323 void ClearCacheOnNavigation();
325 324
326 // Converts the |name|, |value| pair of a http header to a HttpHeaders 325 // Converts the |name|, |value| pair of a http header to a HttpHeaders
327 // dictionary. 326 // dictionary.
328 std::unique_ptr<base::DictionaryValue> CreateHeaderDictionary( 327 std::unique_ptr<base::DictionaryValue> CreateHeaderDictionary(
329 const std::string& name, 328 const std::string& name,
330 const std::string& value); 329 const std::string& value);
331 330
332 // Returns whether |type| is a ResourceType that is handled by the web request
333 // API.
334 bool IsRelevantResourceType(content::ResourceType type);
335
336 // Returns a string representation of |type| or |other| if |type| is not handled
337 // by the web request API.
338 const char* ResourceTypeToString(content::ResourceType type);
339
340 // Stores a |content::ResourceType| representation in |types| if |type_str| is
341 // a resource type handled by the web request API. Returns true in case of
342 // success.
343 bool ParseResourceType(const std::string& type_str,
344 std::vector<content::ResourceType>* types);
345
346 } // namespace extension_web_request_api_helpers 331 } // namespace extension_web_request_api_helpers
347 332
348 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ 333 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698