| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 int tab_id, | 194 int tab_id, |
| 195 int process_id, | 195 int process_id, |
| 196 std::string* error) const; | 196 std::string* error) const; |
| 197 | 197 |
| 198 // Returns true if extension is allowed to obtain the contents of a page as | 198 // Returns true if extension is allowed to obtain the contents of a page as |
| 199 // an image. Since a page may contain sensitive information, this is | 199 // an image. Since a page may contain sensitive information, this is |
| 200 // restricted to the extension's host permissions as well as the extension | 200 // restricted to the extension's host permissions as well as the extension |
| 201 // page itself. | 201 // page itself. |
| 202 bool CanCaptureVisiblePage(int tab_id, std::string* error) const; | 202 bool CanCaptureVisiblePage(int tab_id, std::string* error) const; |
| 203 | 203 |
| 204 const scoped_refptr<const PermissionSet>& active_permissions() const { | 204 // Returns the tab permissions map. |
| 205 TabPermissionsMap CopyTabSpecificPermissionsMap() const; |
| 206 |
| 207 scoped_refptr<const PermissionSet> active_permissions() const { |
| 205 // We lock so that we can't also be setting the permissions while returning. | 208 // We lock so that we can't also be setting the permissions while returning. |
| 206 base::AutoLock auto_lock(runtime_lock_); | 209 base::AutoLock auto_lock(runtime_lock_); |
| 207 return active_permissions_unsafe_; | 210 return active_permissions_unsafe_; |
| 208 } | 211 } |
| 209 | 212 |
| 210 const scoped_refptr<const PermissionSet>& withheld_permissions() const { | 213 scoped_refptr<const PermissionSet> withheld_permissions() const { |
| 211 // We lock so that we can't also be setting the permissions while returning. | 214 // We lock so that we can't also be setting the permissions while returning. |
| 212 base::AutoLock auto_lock(runtime_lock_); | 215 base::AutoLock auto_lock(runtime_lock_); |
| 213 return withheld_permissions_unsafe_; | 216 return withheld_permissions_unsafe_; |
| 214 } | 217 } |
| 215 | 218 |
| 216 const TabPermissionsMap& tab_specific_permissions() const { | |
| 217 // We lock so that we can't also be setting the permissions while returning. | |
| 218 base::AutoLock auto_lock(runtime_lock_); | |
| 219 return tab_specific_permissions_; | |
| 220 } | |
| 221 | |
| 222 #if defined(UNIT_TEST) | 219 #if defined(UNIT_TEST) |
| 223 scoped_refptr<const PermissionSet> GetTabSpecificPermissionsForTesting( | 220 scoped_refptr<const PermissionSet> GetTabSpecificPermissionsForTesting( |
| 224 int tab_id) const { | 221 int tab_id) const { |
| 225 return GetTabSpecificPermissions(tab_id); | 222 return GetTabSpecificPermissions(tab_id); |
| 226 } | 223 } |
| 227 #endif | 224 #endif |
| 228 | 225 |
| 229 private: | 226 private: |
| 230 // Gets the tab-specific host permissions of |tab_id|, or NULL if there | 227 // Gets the tab-specific host permissions of |tab_id|, or NULL if there |
| 231 // aren't any. | 228 // aren't any. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 mutable scoped_refptr<const PermissionSet> withheld_permissions_unsafe_; | 271 mutable scoped_refptr<const PermissionSet> withheld_permissions_unsafe_; |
| 275 | 272 |
| 276 mutable TabPermissionsMap tab_specific_permissions_; | 273 mutable TabPermissionsMap tab_specific_permissions_; |
| 277 | 274 |
| 278 DISALLOW_COPY_AND_ASSIGN(PermissionsData); | 275 DISALLOW_COPY_AND_ASSIGN(PermissionsData); |
| 279 }; | 276 }; |
| 280 | 277 |
| 281 } // namespace extensions | 278 } // namespace extensions |
| 282 | 279 |
| 283 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_DATA_H_ | 280 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_DATA_H_ |
| OLD | NEW |