| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_COMMON_EXTENSIONS_EXTENSION_PERMISSION_SET_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_PERMISSION_SET_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_PERMISSION_SET_H_ | 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_PERMISSION_SET_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 const ExtensionPermissionSet* set1, const ExtensionPermissionSet* set2); | 311 const ExtensionPermissionSet* set1, const ExtensionPermissionSet* set2); |
| 312 | 312 |
| 313 bool operator==(const ExtensionPermissionSet& rhs) const; | 313 bool operator==(const ExtensionPermissionSet& rhs) const; |
| 314 | 314 |
| 315 // Returns true if |set| is a subset of this. | 315 // Returns true if |set| is a subset of this. |
| 316 bool Contains(const ExtensionPermissionSet& set) const; | 316 bool Contains(const ExtensionPermissionSet& set) const; |
| 317 | 317 |
| 318 // Gets the API permissions in this set as a set of strings. | 318 // Gets the API permissions in this set as a set of strings. |
| 319 std::set<std::string> GetAPIsAsStrings() const; | 319 std::set<std::string> GetAPIsAsStrings() const; |
| 320 | 320 |
| 321 // Gets the API permissions in this set, plus any that have implicit access |
| 322 // (such as APIs that require no permissions, or APIs with functions that |
| 323 // require no permissions). |
| 324 // TODO(kalman): return scoped_ptr to avoid copying. |
| 325 std::set<std::string> GetAPIsWithAnyAccessAsStrings() const; |
| 326 |
| 321 // Returns whether this namespace has any functions which the extension has | 327 // Returns whether this namespace has any functions which the extension has |
| 322 // permission to use. For example, even though the extension may not have | 328 // permission to use. For example, even though the extension may not have |
| 323 // the "tabs" permission, "tabs.create" requires no permissions so | 329 // the "tabs" permission, "tabs.create" requires no permissions so |
| 324 // HasAnyAPIPermission("tabs") will return true. | 330 // HasAnyAPIPermission("tabs") will return true. |
| 325 bool HasAnyAccessToAPI(const std::string& api_name) const; | 331 bool HasAnyAccessToAPI(const std::string& api_name) const; |
| 326 | 332 |
| 327 // Gets a list of the distinct hosts for displaying to the user. | 333 // Gets a list of the distinct hosts for displaying to the user. |
| 328 // NOTE: do not use this for comparing permissions, since this disgards some | 334 // NOTE: do not use this for comparing permissions, since this disgards some |
| 329 // information. | 335 // information. |
| 330 std::set<std::string> GetDistinctHostsForDisplay() const; | 336 std::set<std::string> GetDistinctHostsForDisplay() const; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 | 421 |
| 416 // The list of hosts that can be scripted by content scripts. | 422 // The list of hosts that can be scripted by content scripts. |
| 417 // TODO(jstritar): Rename to "user_script_hosts_"? | 423 // TODO(jstritar): Rename to "user_script_hosts_"? |
| 418 URLPatternSet scriptable_hosts_; | 424 URLPatternSet scriptable_hosts_; |
| 419 | 425 |
| 420 // The list of hosts this effectively grants access to. | 426 // The list of hosts this effectively grants access to. |
| 421 URLPatternSet effective_hosts_; | 427 URLPatternSet effective_hosts_; |
| 422 }; | 428 }; |
| 423 | 429 |
| 424 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_PERMISSION_SET_H_ | 430 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_PERMISSION_SET_H_ |
| OLD | NEW |