| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 static PermissionSet* CreateUnion( | 60 static PermissionSet* CreateUnion( |
| 61 const PermissionSet* set1, const PermissionSet* set2); | 61 const PermissionSet* set1, const PermissionSet* set2); |
| 62 | 62 |
| 63 // Creates a new permission set that only contains permissions that must be | 63 // Creates a new permission set that only contains permissions that must be |
| 64 // in the manifest. Passes ownership of the new set to the caller. | 64 // in the manifest. Passes ownership of the new set to the caller. |
| 65 static PermissionSet* ExcludeNotInManifestPermissions( | 65 static PermissionSet* ExcludeNotInManifestPermissions( |
| 66 const PermissionSet* set); | 66 const PermissionSet* set); |
| 67 | 67 |
| 68 bool operator==(const PermissionSet& rhs) const; | 68 bool operator==(const PermissionSet& rhs) const; |
| 69 | 69 |
| 70 // Returns true if |set| is a subset of this. | 70 // Returns true if every API or host permission available to |set| is also |
| 71 // available to this. In other words, if the API permissions of |set| are a |
| 72 // subset of this, and the host permissions in this encompass those in |set|. |
| 71 bool Contains(const PermissionSet& set) const; | 73 bool Contains(const PermissionSet& set) const; |
| 72 | 74 |
| 73 // Gets the API permissions in this set as a set of strings. | 75 // Gets the API permissions in this set as a set of strings. |
| 74 std::set<std::string> GetAPIsAsStrings() const; | 76 std::set<std::string> GetAPIsAsStrings() const; |
| 75 | 77 |
| 76 // Returns whether this namespace has any functions which the extension has | 78 // Returns whether this namespace has any functions which the extension has |
| 77 // permission to use. For example, even though the extension may not have | 79 // permission to use. For example, even though the extension may not have |
| 78 // the "tabs" permission, "tabs.create" requires no permissions so | 80 // the "tabs" permission, "tabs.create" requires no permissions so |
| 79 // HasAnyAccessToAPI("tabs") will return true. | 81 // HasAnyAccessToAPI("tabs") will return true. |
| 80 bool HasAnyAccessToAPI(const std::string& api_name) const; | 82 bool HasAnyAccessToAPI(const std::string& api_name) const; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 // TODO(jstritar): Rename to "user_script_hosts_"? | 203 // TODO(jstritar): Rename to "user_script_hosts_"? |
| 202 URLPatternSet scriptable_hosts_; | 204 URLPatternSet scriptable_hosts_; |
| 203 | 205 |
| 204 // The list of hosts this effectively grants access to. | 206 // The list of hosts this effectively grants access to. |
| 205 URLPatternSet effective_hosts_; | 207 URLPatternSet effective_hosts_; |
| 206 }; | 208 }; |
| 207 | 209 |
| 208 } // namespace extensions | 210 } // namespace extensions |
| 209 | 211 |
| 210 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_ | 212 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_ |
| OLD | NEW |