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..f2e8364d82853a245a0b7259dda2537e381e3217 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 |
not at google - send to devlin
2014/05/21 20:10:20
Can we call this ShouldWarnForAllHosts then? "most
Devlin
2014/05/21 23:16:07
Done.
|
+ // should treat it as all hosts for warning purposes. |
+ // For example, '*://*.com/*'. |
+ bool HasAccessToMostHosts() 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 InitHasAccessToMostHosts() const; |
+ |
// The api list is used when deciding if an extension can access certain |
// extension APIs and features. |
APIPermissionSet apis_; |
@@ -147,6 +153,13 @@ class PermissionSet |
// The list of hosts this effectively grants access to. |
URLPatternSet effective_hosts_; |
+ |
+ // Whether or not this permission set includes access to so many origins, we |
+ // should treat it as all_hosts for warning purposes. |
+ // Lazily set upon first retrieval, and stored for performance sake. |
+ // Mutable, because setting this does not change the logical state of the |
+ // permission set, and is done only for performance purposes. |
+ mutable scoped_ptr<bool> has_access_to_most_hosts_; |
not at google - send to devlin
2014/05/21 20:10:20
a pointer for this seems like overkill. could you
Devlin
2014/05/21 23:16:07
Why not.
|
}; |
} // namespace extensions |