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 // 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 |set| is a subset of this. |
71 bool Contains(const PermissionSet& set) const; | 71 bool Contains(const PermissionSet& set) const; |
72 | 72 |
| 73 // Returns true if the API permissions in |set| are a subset of this, and the |
| 74 // host permissions in this encompass those in |set|. |
| 75 // |
| 76 // See URLPatternSet::Encompasses for more info. |
| 77 bool ContainsOrEncompasses(const PermissionSet& set) const; |
| 78 |
73 // Gets the API permissions in this set as a set of strings. | 79 // Gets the API permissions in this set as a set of strings. |
74 std::set<std::string> GetAPIsAsStrings() const; | 80 std::set<std::string> GetAPIsAsStrings() const; |
75 | 81 |
76 // Returns whether this namespace has any functions which the extension has | 82 // Returns whether this namespace has any functions which the extension has |
77 // permission to use. For example, even though the extension may not have | 83 // permission to use. For example, even though the extension may not have |
78 // the "tabs" permission, "tabs.create" requires no permissions so | 84 // the "tabs" permission, "tabs.create" requires no permissions so |
79 // HasAnyAccessToAPI("tabs") will return true. | 85 // HasAnyAccessToAPI("tabs") will return true. |
80 bool HasAnyAccessToAPI(const std::string& api_name) const; | 86 bool HasAnyAccessToAPI(const std::string& api_name) const; |
81 | 87 |
82 // Gets the localized permission messages that represent this set. | 88 // Gets the localized permission messages that represent this set. |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // TODO(jstritar): Rename to "user_script_hosts_"? | 207 // TODO(jstritar): Rename to "user_script_hosts_"? |
202 URLPatternSet scriptable_hosts_; | 208 URLPatternSet scriptable_hosts_; |
203 | 209 |
204 // The list of hosts this effectively grants access to. | 210 // The list of hosts this effectively grants access to. |
205 URLPatternSet effective_hosts_; | 211 URLPatternSet effective_hosts_; |
206 }; | 212 }; |
207 | 213 |
208 } // namespace extensions | 214 } // namespace extensions |
209 | 215 |
210 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_ | 216 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_ |
OLD | NEW |