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

Unified Diff: extensions/common/permissions/permission_set.h

Issue 293003008: Make ActiveScriptController use Active Tab-style permissions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Latest master for CQ Created 6 years, 7 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: extensions/common/permissions/permission_set.h
diff --git a/extensions/common/permissions/permission_set.h b/extensions/common/permissions/permission_set.h
index 9e6a7b99c98a109442f94226a149013ef2e6aac9..f076b6fee4d70f8cd1e07806bc90e3547fed727f 100644
--- a/extensions/common/permissions/permission_set.h
+++ b/extensions/common/permissions/permission_set.h
@@ -96,6 +96,11 @@ class PermissionSet
// origins.
bool HasEffectiveAccessToAllHosts() const;
+ // Returns true if this permission set has access to so many hosts, that we
+ // should treat it as all hosts for warning purposes.
+ // For example, '*://*.com/*'.
+ bool ShouldWarnAllHosts() const;
+
// Returns true if this permission set includes effective access to |url|.
bool HasEffectiveAccessToURL(const GURL& url) const;
@@ -121,14 +126,15 @@ class PermissionSet
~PermissionSet();
- void AddAPIPermission(APIPermission::ID id);
-
// Adds permissions implied independently of other context.
void InitImplicitPermissions();
// Initializes the effective host permission based on the data in this set.
void InitEffectiveHosts();
+ // Initializes |has_access_to_most_hosts_|.
+ void InitShouldWarnAllHosts() const;
+
// The api list is used when deciding if an extension can access certain
// extension APIs and features.
APIPermissionSet apis_;
@@ -147,6 +153,16 @@ class PermissionSet
// The list of hosts this effectively grants access to.
URLPatternSet effective_hosts_;
+
+ enum ShouldWarnAllHostsType {
+ UNINITIALIZED = 0,
+ WARN_ALL_HOSTS,
+ DONT_WARN_ALL_HOSTS
+ };
+ // Whether or not this permission set includes access to so many origins, we
+ // should treat it as all_hosts for warning purposes.
+ // Lazily initialized (and therefore mutable).
+ mutable ShouldWarnAllHostsType should_warn_all_hosts_;
};
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698