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_
11 #include "base/basictypes.h"
15 namespace extensions
{
23 // This class is used to test whether extensions may modify web requests.
24 class WebRequestPermissions
{
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
39 static bool CanExtensionAccessURL(
40 const extensions::InfoMap
* extension_info_map
,
41 const std::string
& extension_id
,
43 bool crosses_incognito
,
44 HostPermissionsCheck host_permissions_check
);
47 DISALLOW_IMPLICIT_CONSTRUCTORS(WebRequestPermissions
);
50 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_PERMISSIONS_H_