Chromium Code Reviews| 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..edd78eb690e1a210742dee1aaa75a50aee913880 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,18 @@ 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 set upon first retrieval, and stored for performance sake. |
|
not at google - send to devlin
2014/05/21 23:33:45
I think just "Lazily initialized" covers the last
Devlin
2014/05/22 15:52:14
Done.
|
| + // Mutable, because setting this does not change the logical state of the |
| + // permission set, and is done only for performance purposes. |
| + mutable ShouldWarnAllHostsType should_warn_all_hosts_; |
| }; |
| } // namespace extensions |