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

Unified Diff: chrome/common/extensions/extension.h

Issue 341029: Only dispatch tab events when there is someone listening (Closed)
Patch Set: pre-review Created 11 years, 2 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/common/extensions/extension.h
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h
index 79ea12d7aeb128d28540d863daf78f38f3386edb..cb5bd4b37f628965370ba7691c79e9911aaadbf2 100644
--- a/chrome/common/extensions/extension.h
+++ b/chrome/common/extensions/extension.h
@@ -71,6 +71,9 @@ class Extension {
static const int kBrowserActionIconMaxSize;
// Each permission is a module that the extension is permitted to use.
+ static const char* kTabPermission;
+ static const char* kBookmarkPermission;
+
static const char* kPermissionNames[];
static const size_t kNumPermissions;
@@ -210,6 +213,12 @@ class Extension {
// specified URL.
bool CanAccessHost(const GURL& url) const;
+ // Returns true if the extension has the specified API permission.
+ bool HasApiPermission(const std::string& permission) const {
+ return std::find(api_permissions_.begin(), api_permissions_.end(),
+ permission) != api_permissions_.end();
+ }
+
// Returns the set of hosts that the extension effectively has access to. This
// is used in the permissions UI and is a combination of the hosts accessible
// through content scripts and the hosts accessible through XHR.

Powered by Google App Engine
This is Rietveld 408576698