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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // following situations: | 61 // following situations: |
62 // - when installing or upgrading packed extensions | 62 // - when installing or upgrading packed extensions |
63 // - when installing unpacked extensions that have NPAPI plugins | 63 // - when installing unpacked extensions that have NPAPI plugins |
64 // - when either type of extension requests optional permissions | 64 // - when either type of extension requests optional permissions |
65 static bool CanSilentlyIncreasePermissions(const Extension* extension); | 65 static bool CanSilentlyIncreasePermissions(const Extension* extension); |
66 | 66 |
67 // Returns true if the extension is a COMPONENT extension or is on the | 67 // Returns true if the extension is a COMPONENT extension or is on the |
68 // whitelist of extensions that can script all pages. | 68 // whitelist of extensions that can script all pages. |
69 static bool CanExecuteScriptEverywhere(const Extension* extension); | 69 static bool CanExecuteScriptEverywhere(const Extension* extension); |
70 | 70 |
| 71 // Returns true if the given |url| is restricted for the given |extension|, |
| 72 // as is commonly the case for chrome:// urls. |
| 73 // NOTE: You probably want to use CanAccessPage(). |
| 74 static bool IsRestrictedUrl(const GURL& document_url, |
| 75 const GURL& top_frame_url, |
| 76 const Extension* extension, |
| 77 std::string* error); |
| 78 |
71 // Sets the runtime permissions of the given |extension| to |permissions|. | 79 // Sets the runtime permissions of the given |extension| to |permissions|. |
72 void SetActivePermissions(const PermissionSet* active) const; | 80 void SetActivePermissions(const PermissionSet* active) const; |
73 | 81 |
74 // Updates the tab-specific permissions of |tab_id| to include those from | 82 // Updates the tab-specific permissions of |tab_id| to include those from |
75 // |permissions|. | 83 // |permissions|. |
76 void UpdateTabSpecificPermissions( | 84 void UpdateTabSpecificPermissions( |
77 int tab_id, | 85 int tab_id, |
78 scoped_refptr<const PermissionSet> permissions) const; | 86 scoped_refptr<const PermissionSet> permissions) const; |
79 | 87 |
80 // Clears the tab-specific permissions of |tab_id|. | 88 // Clears the tab-specific permissions of |tab_id|. |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 mutable scoped_refptr<const PermissionSet> active_permissions_unsafe_; | 225 mutable scoped_refptr<const PermissionSet> active_permissions_unsafe_; |
218 | 226 |
219 mutable TabPermissionsMap tab_specific_permissions_; | 227 mutable TabPermissionsMap tab_specific_permissions_; |
220 | 228 |
221 DISALLOW_COPY_AND_ASSIGN(PermissionsData); | 229 DISALLOW_COPY_AND_ASSIGN(PermissionsData); |
222 }; | 230 }; |
223 | 231 |
224 } // namespace extensions | 232 } // namespace extensions |
225 | 233 |
226 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_DATA_H_ | 234 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_DATA_H_ |
OLD | NEW |