Chromium Code Reviews| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 static bool CanExecuteScriptEverywhere(const Extension* extension); | 64 static bool CanExecuteScriptEverywhere(const Extension* extension); |
| 65 | 65 |
| 66 // Returns true if the --scripts-require-action flag would possibly affect | 66 // Returns true if the --scripts-require-action flag would possibly affect |
| 67 // the given |extension| and |permissions|. We pass in the |permissions| | 67 // the given |extension| and |permissions|. We pass in the |permissions| |
| 68 // explicitly, as we may need to check with permissions other than the ones | 68 // explicitly, as we may need to check with permissions other than the ones |
| 69 // that are currently on the extension's PermissionsData. | 69 // that are currently on the extension's PermissionsData. |
| 70 static bool ScriptsMayRequireActionForExtension( | 70 static bool ScriptsMayRequireActionForExtension( |
| 71 const Extension* extension, | 71 const Extension* extension, |
| 72 const PermissionSet* permissions); | 72 const PermissionSet* permissions); |
| 73 | 73 |
| 74 // Returns true if we should skip the permisisons warning for the extension | 74 // Returns true if we should skip the permissons warning for the extension |
|
Yoyo Zhou
2015/03/11 01:33:23
nit: permissions
Marc Treib
2015/03/11 13:08:52
Done.
| |
| 75 // with the given |extension_id|. | 75 // with the given |extension_id|. |
| 76 static bool ShouldSkipPermissionWarnings(const std::string& extension_id); | 76 static bool ShouldSkipPermissionWarnings(const std::string& extension_id); |
| 77 | 77 |
| 78 // Returns true if the given |url| is restricted for the given |extension|, | 78 // Returns true if the given |url| is restricted for the given |extension|, |
| 79 // as is commonly the case for chrome:// urls. | 79 // as is commonly the case for chrome:// urls. |
| 80 // NOTE: You probably want to use CanAccessPage(). | 80 // NOTE: You probably want to use CanAccessPage(). |
| 81 static bool IsRestrictedUrl(const GURL& document_url, | 81 static bool IsRestrictedUrl(const GURL& document_url, |
| 82 const GURL& top_frame_url, | 82 const GURL& top_frame_url, |
| 83 const Extension* extension, | 83 const Extension* extension, |
| 84 std::string* error); | 84 std::string* error); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 | 126 |
| 127 // Whether the extension has effective access to all hosts. This is true if | 127 // Whether the extension has effective access to all hosts. This is true if |
| 128 // there is a content script that matches all hosts, if there is a host | 128 // there is a content script that matches all hosts, if there is a host |
| 129 // permission grants access to all hosts (like <all_urls>) or an api | 129 // permission grants access to all hosts (like <all_urls>) or an api |
| 130 // permission that effectively grants access to all hosts (e.g. proxy, | 130 // permission that effectively grants access to all hosts (e.g. proxy, |
| 131 // network, etc.) | 131 // network, etc.) |
| 132 bool HasEffectiveAccessToAllHosts() const; | 132 bool HasEffectiveAccessToAllHosts() const; |
| 133 | 133 |
| 134 // Returns the full list of permission messages that should display at | 134 // Returns the full list of permission messages that should display at |
| 135 // install time. | 135 // install time. |
| 136 // TODO(sashab): Deprecate this in favor of GetCoalescedPermissionMessages(). | 136 // Deprecated; use GetCoalescedPermissionMessages() instead. |
| 137 PermissionMessages GetPermissionMessages() const; | 137 // TODO(treib): Remove this once we've fully switched to the new system. |
| 138 PermissionMessages GetLegacyPermissionMessages() const; | |
|
Yoyo Zhou
2015/03/11 01:33:23
Here's my thinking about flags. Ideally, we have s
Marc Treib
2015/03/11 13:08:52
Alright. I'll do that and ping you again.
| |
| 138 | 139 |
| 139 // Returns the full list of permission messages that should display at install | 140 // Returns the full list of permission messages that should display at install |
| 140 // time as strings. | 141 // time as strings. |
| 141 // TODO(sashab): Deprecate this in favor of GetCoalescedPermissionMessages(). | 142 // Deprecated; use GetCoalescedPermissionMessages() instead. |
| 142 std::vector<base::string16> GetPermissionMessageStrings() const; | 143 // TODO(treib): Remove this once we've fully switched to the new system. |
| 144 std::vector<base::string16> GetLegacyPermissionMessageStrings() const; | |
| 143 | 145 |
| 144 // Returns the full list of permission details for messages that should | 146 // Returns the full list of permission details for messages that should |
| 145 // display at install time as strings. | 147 // display at install time as strings. |
| 146 // TODO(sashab): Deprecate this in favor of GetCoalescedPermissionMessages(). | 148 // Deprecated; use GetCoalescedPermissionMessages() instead. |
| 147 std::vector<base::string16> GetPermissionMessageDetailsStrings() const; | 149 // TODO(treib): Remove this once we've fully switched to the new system. |
| 150 std::vector<base::string16> GetLegacyPermissionMessageDetailsStrings() const; | |
| 148 | 151 |
| 149 // Returns the full list of permission details for messages that should | 152 // Returns the full list of permission details for messages that should |
| 150 // display at install time, in a nested format ready for display. | 153 // display at install time, in a nested format ready for display. |
| 151 CoalescedPermissionMessages GetCoalescedPermissionMessages() const; | 154 CoalescedPermissionMessages GetCoalescedPermissionMessages() const; |
| 152 | 155 |
| 153 // Returns true if the extension has requested all-hosts permissions (or | 156 // Returns true if the extension has requested all-hosts permissions (or |
| 154 // something close to it), but has had it withheld. | 157 // something close to it), but has had it withheld. |
| 155 bool HasWithheldImpliedAllHosts() const; | 158 bool HasWithheldImpliedAllHosts() const; |
| 156 | 159 |
| 157 // Returns true if the |extension| has permission to access and interact with | 160 // Returns true if the |extension| has permission to access and interact with |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 277 mutable scoped_refptr<const PermissionSet> withheld_permissions_unsafe_; | 280 mutable scoped_refptr<const PermissionSet> withheld_permissions_unsafe_; |
| 278 | 281 |
| 279 mutable TabPermissionsMap tab_specific_permissions_; | 282 mutable TabPermissionsMap tab_specific_permissions_; |
| 280 | 283 |
| 281 DISALLOW_COPY_AND_ASSIGN(PermissionsData); | 284 DISALLOW_COPY_AND_ASSIGN(PermissionsData); |
| 282 }; | 285 }; |
| 283 | 286 |
| 284 } // namespace extensions | 287 } // namespace extensions |
| 285 | 288 |
| 286 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_DATA_H_ | 289 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_DATA_H_ |
| OLD | NEW |