OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_DATA_H_ | 5 #ifndef EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_DATA_H_ |
6 #define EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_DATA_H_ | 6 #define EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_DATA_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // Note this does not include APIs with no corresponding permission, like | 108 // Note this does not include APIs with no corresponding permission, like |
109 // "runtime" or "browserAction". | 109 // "runtime" or "browserAction". |
110 // TODO(mpcomplete): drop the "API" from these names, it's confusing. | 110 // TODO(mpcomplete): drop the "API" from these names, it's confusing. |
111 bool HasAPIPermission(APIPermission::ID permission) const; | 111 bool HasAPIPermission(APIPermission::ID permission) const; |
112 bool HasAPIPermission(const std::string& permission_name) const; | 112 bool HasAPIPermission(const std::string& permission_name) const; |
113 bool HasAPIPermissionForTab(int tab_id, APIPermission::ID permission) const; | 113 bool HasAPIPermissionForTab(int tab_id, APIPermission::ID permission) const; |
114 bool CheckAPIPermissionWithParam( | 114 bool CheckAPIPermissionWithParam( |
115 APIPermission::ID permission, | 115 APIPermission::ID permission, |
116 const APIPermission::CheckParam* param) const; | 116 const APIPermission::CheckParam* param) const; |
117 | 117 |
118 // TODO(rdevlin.cronin): GetEffectiveHostPermissions(), HasHostPermission(), | 118 // Returns the effective hosts associated with the active permissions and the |
119 // and HasEffectiveAccessToAllHosts() are just forwards for the active | 119 // current tab permissions. |
| 120 URLPatternSet GetEffectiveHostPermissions() const; |
| 121 |
| 122 // TODO(rdevlin.cronin): HasHostPermission() and |
| 123 // HasEffectiveAccessToAllHosts() are just forwards for the active |
120 // permissions. We should either get rid of these, and have callers use | 124 // permissions. We should either get rid of these, and have callers use |
121 // active_permissions(), or should get rid of active_permissions(), and make | 125 // active_permissions(), or should get rid of active_permissions(), and make |
122 // callers use PermissionsData for everything. We should not do both. | 126 // callers use PermissionsData for everything. We should not do both. |
123 | 127 |
124 // Returns the effective hosts associated with the active permissions. | |
125 const URLPatternSet& GetEffectiveHostPermissions() const; | |
126 | |
127 // Whether the extension has access to the given |url|. | 128 // Whether the extension has access to the given |url|. |
128 bool HasHostPermission(const GURL& url) const; | 129 bool HasHostPermission(const GURL& url) const; |
129 | 130 |
130 // Whether the extension has effective access to all hosts. This is true if | 131 // Whether the extension has effective access to all hosts. This is true if |
131 // there is a content script that matches all hosts, if there is a host | 132 // there is a content script that matches all hosts, if there is a host |
132 // permission grants access to all hosts (like <all_urls>) or an api | 133 // permission grants access to all hosts (like <all_urls>) or an api |
133 // permission that effectively grants access to all hosts (e.g. proxy, | 134 // permission that effectively grants access to all hosts (e.g. proxy, |
134 // network, etc.) | 135 // network, etc.) |
135 bool HasEffectiveAccessToAllHosts() const; | 136 bool HasEffectiveAccessToAllHosts() const; |
136 | 137 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 mutable scoped_refptr<const PermissionSet> withheld_permissions_unsafe_; | 269 mutable scoped_refptr<const PermissionSet> withheld_permissions_unsafe_; |
269 | 270 |
270 mutable TabPermissionsMap tab_specific_permissions_; | 271 mutable TabPermissionsMap tab_specific_permissions_; |
271 | 272 |
272 DISALLOW_COPY_AND_ASSIGN(PermissionsData); | 273 DISALLOW_COPY_AND_ASSIGN(PermissionsData); |
273 }; | 274 }; |
274 | 275 |
275 } // namespace extensions | 276 } // namespace extensions |
276 | 277 |
277 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_DATA_H_ | 278 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_DATA_H_ |
OLD | NEW |