Add ICU message format support
[chromium-blink-merge.git] / extensions / browser / api / web_request / web_request_permissions.h
blob44ef0eb6c7d9b3e950548b2396a34cfc45daef4c
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
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_PERMISSIONS_H_
6 #define EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_PERMISSIONS_H_
8 #include <map>
9 #include <string>
11 #include "base/basictypes.h"
13 class GURL;
15 namespace extensions {
16 class InfoMap;
19 namespace net {
20 class URLRequest;
23 // This class is used to test whether extensions may modify web requests.
24 class WebRequestPermissions {
25 public:
26 // Different host permission checking modes for CanExtensionAccessURL.
27 enum HostPermissionsCheck {
28 DO_NOT_CHECK_HOST = 0, // No check.
29 REQUIRE_HOST_PERMISSION, // Permission needed for given URL.
30 REQUIRE_ALL_URLS // Permission needed for <all_urls>.
33 // Returns true if the request shall not be reported to extensions.
34 static bool HideRequest(const extensions::InfoMap* extension_info_map,
35 const net::URLRequest* request);
37 // |host_permission_check| controls how permissions are checked with regard to
38 // |url|.
39 static bool CanExtensionAccessURL(
40 const extensions::InfoMap* extension_info_map,
41 const std::string& extension_id,
42 const GURL& url,
43 bool crosses_incognito,
44 HostPermissionsCheck host_permissions_check);
46 private:
47 DISALLOW_IMPLICIT_CONSTRUCTORS(WebRequestPermissions);
50 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_PERMISSIONS_H_