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

Unified Diff: chrome/browser/extensions/api/web_request/web_request_permissions.h

Issue 10831008: Refactor and fix declarative webRequest API permissions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/web_request/web_request_permissions.h
diff --git a/chrome/browser/extensions/api/web_request/web_request_permissions.h b/chrome/browser/extensions/api/web_request/web_request_permissions.h
new file mode 100644
index 0000000000000000000000000000000000000000..8ddd14762eb150806f4510a4a631987e5264439a
--- /dev/null
+++ b/chrome/browser/extensions/api/web_request/web_request_permissions.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_PERMISSIONS_H_
+#define CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_PERMISSIONS_H_
+
+#include <map>
+#include <string>
+
+class ExtensionInfoMap;
+class GURL;
+
+namespace net {
+class URLRequest;
+}
+
+// This class is used to test whether extensions may modify web requests.
+class WebRequestPermissions {
+ public:
+ WebRequestPermissions();
+ ~WebRequestPermissions();
+
+ // Returns true if the request shall not be reported to extensions.
+ static bool HideRequest(const net::URLRequest* request);
+
+ // Called when an incognito profile is created or destroyed.
+ void OnOTRProfileCreated(void* original_profile,
+ void* otr_profile);
+ void OnOTRProfileDestroyed(void* original_profile,
+ void* otr_profile);
+
+ void* GetCrossProfile(void* profile) const;
+
+ bool CanExtensionAccessURL(const ExtensionInfoMap* extension_info_map,
+ const std::string& extension_id,
+ const GURL& url,
+ bool crosses_incognito,
+ bool enforce_host_permissions) const;
+ private:
+ typedef std::map<void*, void*> CrossProfileMap;
+
+ // A map of original profile -> corresponding incognito profile (and vice
+ // versa).
+ CrossProfileMap cross_profile_map_;
Matt Perry 2012/07/25 21:27:56 If you move this back to the event router, then th
battre 2012/07/26 16:38:43 Done. I have left this class rather than moving e
Matt Perry 2012/07/26 18:42:41 Agreed - I only meant to move cross_profile_map_.
+};
+
+#endif // CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_PERMISSIONS_H_

Powered by Google App Engine
This is Rietveld 408576698