| 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_PERMISSIONS_PERMISSION_SET_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_ | 6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 // Returns true if |set| is a subset of this. | 64 // Returns true if |set| is a subset of this. |
| 65 bool Contains(const PermissionSet& set) const; | 65 bool Contains(const PermissionSet& set) const; |
| 66 | 66 |
| 67 // Gets the API permissions in this set as a set of strings. | 67 // Gets the API permissions in this set as a set of strings. |
| 68 std::set<std::string> GetAPIsAsStrings() const; | 68 std::set<std::string> GetAPIsAsStrings() const; |
| 69 | 69 |
| 70 // Gets the API permissions in this set, plus any that have implicit access | 70 // Gets the API permissions in this set, plus any that have implicit access |
| 71 // (such as APIs that require no permissions, or APIs with functions that | 71 // (such as APIs that require no permissions, or APIs with functions that |
| 72 // require no permissions). | 72 // require no permissions). |
| 73 // TODO(kalman): return scoped_ptr to avoid copying. | |
| 74 std::set<std::string> GetAPIsWithAnyAccessAsStrings() const; | 73 std::set<std::string> GetAPIsWithAnyAccessAsStrings() const; |
| 75 | 74 |
| 76 // Returns whether this namespace has any functions which the extension has | 75 // Returns whether this namespace has any functions which the extension has |
| 77 // permission to use. For example, even though the extension may not have | 76 // permission to use. For example, even though the extension may not have |
| 78 // the "tabs" permission, "tabs.create" requires no permissions so | 77 // the "tabs" permission, "tabs.create" requires no permissions so |
| 79 // HasAnyAPIPermission("tabs") will return true. | 78 // HasAnyAPIPermission("tabs") will return true. |
| 80 bool HasAnyAccessToAPI(const std::string& api_name) const; | 79 bool HasAnyAccessToAPI(const std::string& api_name) const; |
| 81 | 80 |
| 82 // Gets a list of the distinct hosts for displaying to the user. | 81 // Gets a list of the distinct hosts for displaying to the user. |
| 83 // NOTE: do not use this for comparing permissions, since this disgards some | 82 // NOTE: do not use this for comparing permissions, since this disgards some |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 // TODO(jstritar): Rename to "user_script_hosts_"? | 175 // TODO(jstritar): Rename to "user_script_hosts_"? |
| 177 URLPatternSet scriptable_hosts_; | 176 URLPatternSet scriptable_hosts_; |
| 178 | 177 |
| 179 // The list of hosts this effectively grants access to. | 178 // The list of hosts this effectively grants access to. |
| 180 URLPatternSet effective_hosts_; | 179 URLPatternSet effective_hosts_; |
| 181 }; | 180 }; |
| 182 | 181 |
| 183 } // namespace extensions | 182 } // namespace extensions |
| 184 | 183 |
| 185 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_ | 184 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_ |
| OLD | NEW |