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

Side by Side Diff: chrome/browser/extensions/api/web_request/web_request_permissions.h

Issue 14358004: Almost all actions in Declarative Web Request require all_urls host permissions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: All URLs -> all hosts; also rebased Created 7 years, 8 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 | Annotate | Revision Log
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 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_PERMISSIONS_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_PERMISSIONS_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_PERMISSIONS_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_PERMISSIONS_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 12
13 class ExtensionInfoMap; 13 class ExtensionInfoMap;
14 class GURL; 14 class GURL;
15 15
16 namespace net { 16 namespace net {
17 class URLRequest; 17 class URLRequest;
18 } 18 }
19 19
20 // This class is used to test whether extensions may modify web requests. 20 // This class is used to test whether extensions may modify web requests.
21 class WebRequestPermissions { 21 class WebRequestPermissions {
22 public: 22 public:
23 // Different host permission checking modes for CanExtensionAccessURL.
24 enum HostPermissionsCheck {
25 DO_NOT_CHECK_HOST = 0, // No check.
26 REQUIRE_HOST_PERMISSION, // Permission needed for given URL.
27 REQUIRE_ALL_URLS // Permission needed for <all_urls>.
28 };
29
23 // Returns true if the request shall not be reported to extensions. 30 // Returns true if the request shall not be reported to extensions.
24 static bool HideRequest(const ExtensionInfoMap* extension_info_map, 31 static bool HideRequest(const ExtensionInfoMap* extension_info_map,
25 const net::URLRequest* request); 32 const net::URLRequest* request);
26 33
27 static bool CanExtensionAccessURL(const ExtensionInfoMap* extension_info_map, 34 // |host_permission_check| controls how permissions are checked with regard to
28 const std::string& extension_id, 35 // |url|.
29 const GURL& url, 36 static bool CanExtensionAccessURL(
30 bool crosses_incognito, 37 const ExtensionInfoMap* extension_info_map,
31 bool enforce_host_permissions); 38 const std::string& extension_id,
39 const GURL& url,
40 bool crosses_incognito,
41 HostPermissionsCheck host_permissions_check);
32 42
33 private: 43 private:
34 DISALLOW_IMPLICIT_CONSTRUCTORS(WebRequestPermissions); 44 DISALLOW_IMPLICIT_CONSTRUCTORS(WebRequestPermissions);
35 }; 45 };
36 46
37 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_PERMISSIONS_H_ 47 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_PERMISSIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698