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 |