| 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 <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // Whether the |extension| has access to the given |url|. | 128 // Whether the |extension| has access to the given |url|. |
| 129 static bool HasHostPermission(const Extension* extension, const GURL& url); | 129 static bool HasHostPermission(const Extension* extension, const GURL& url); |
| 130 | 130 |
| 131 // 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 |
| 132 // 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 |
| 133 // 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 |
| 134 // permission that effectively grants access to all hosts (e.g. proxy, | 134 // permission that effectively grants access to all hosts (e.g. proxy, |
| 135 // network, etc.) | 135 // network, etc.) |
| 136 static bool HasEffectiveAccessToAllHosts(const Extension* extension); | 136 static bool HasEffectiveAccessToAllHosts(const Extension* extension); |
| 137 | 137 |
| 138 // Whether the extension has access to so many hosts that we should treat it |
| 139 // as "all_hosts" for warning purposes. |
| 140 // For example, '*://*.com/*'. |
| 141 static bool ShouldWarnAllHosts(const Extension* extension); |
| 142 |
| 138 // Returns the full list of permission messages that the given |extension| | 143 // Returns the full list of permission messages that the given |extension| |
| 139 // should display at install time. | 144 // should display at install time. |
| 140 static PermissionMessages GetPermissionMessages(const Extension* extension); | 145 static PermissionMessages GetPermissionMessages(const Extension* extension); |
| 141 // Returns the full list of permission messages that the given |extension| | 146 // Returns the full list of permission messages that the given |extension| |
| 142 // should display at install time. The messages are returned as strings | 147 // should display at install time. The messages are returned as strings |
| 143 // for convenience. | 148 // for convenience. |
| 144 static std::vector<base::string16> GetPermissionMessageStrings( | 149 static std::vector<base::string16> GetPermissionMessageStrings( |
| 145 const Extension* extension); | 150 const Extension* extension); |
| 146 | 151 |
| 147 // Returns the full list of permission details for messages that the given | 152 // Returns the full list of permission details for messages that the given |
| (...skipping 24 matching lines...) Expand all Loading... |
| 172 // Returns true if the |extension| is allowed to obtain the contents of a | 177 // Returns true if the |extension| is allowed to obtain the contents of a |
| 173 // page as an image. Since a page may contain sensitive information, this | 178 // page as an image. Since a page may contain sensitive information, this |
| 174 // is restricted to the extension's host permissions as well as the | 179 // is restricted to the extension's host permissions as well as the |
| 175 // extension page itself. | 180 // extension page itself. |
| 176 static bool CanCaptureVisiblePage(const Extension* extension, | 181 static bool CanCaptureVisiblePage(const Extension* extension, |
| 177 int tab_id, | 182 int tab_id, |
| 178 std::string* error); | 183 std::string* error); |
| 179 | 184 |
| 180 // Returns true if the user should be alerted that the |extension| is running | 185 // Returns true if the user should be alerted that the |extension| is running |
| 181 // a script. | 186 // a script. |
| 182 static bool RequiresActionForScriptExecution(const Extension* extension); | 187 static bool RequiresActionForScriptExecution(const Extension* extension, |
| 188 int tab_id, |
| 189 const GURL& url); |
| 183 | 190 |
| 184 // Parse the permissions of a given extension in the initialization process. | 191 // Parse the permissions of a given extension in the initialization process. |
| 185 bool ParsePermissions(Extension* extension, base::string16* error); | 192 bool ParsePermissions(Extension* extension, base::string16* error); |
| 186 | 193 |
| 187 // Ensure manifest handlers provide their custom manifest permissions. | 194 // Ensure manifest handlers provide their custom manifest permissions. |
| 188 void InitializeManifestPermissions(Extension* extension); | 195 void InitializeManifestPermissions(Extension* extension); |
| 189 | 196 |
| 190 // Finalize permissions after the initialization process completes. | 197 // Finalize permissions after the initialization process completes. |
| 191 void FinalizePermissions(Extension* extension); | 198 void FinalizePermissions(Extension* extension); |
| 192 | 199 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 212 mutable scoped_refptr<const PermissionSet> active_permissions_; | 219 mutable scoped_refptr<const PermissionSet> active_permissions_; |
| 213 | 220 |
| 214 mutable TabPermissionsMap tab_specific_permissions_; | 221 mutable TabPermissionsMap tab_specific_permissions_; |
| 215 | 222 |
| 216 DISALLOW_COPY_AND_ASSIGN(PermissionsData); | 223 DISALLOW_COPY_AND_ASSIGN(PermissionsData); |
| 217 }; | 224 }; |
| 218 | 225 |
| 219 } // namespace extensions | 226 } // namespace extensions |
| 220 | 227 |
| 221 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_DATA_H_ | 228 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSIONS_DATA_H_ |
| OLD | NEW |