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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // Creates a new permission set equal to the intersection of |set1| and | 52 // Creates a new permission set equal to the intersection of |set1| and |
53 // |set2|, passing ownership of the new set to the caller. | 53 // |set2|, passing ownership of the new set to the caller. |
54 static PermissionSet* CreateIntersection( | 54 static PermissionSet* CreateIntersection( |
55 const PermissionSet* set1, const PermissionSet* set2); | 55 const PermissionSet* set1, const PermissionSet* set2); |
56 | 56 |
57 // Creates a new permission set equal to the union of |set1| and |set2|. | 57 // Creates a new permission set equal to the union of |set1| and |set2|. |
58 // Passes ownership of the new set to the caller. | 58 // Passes ownership of the new set to the caller. |
59 static PermissionSet* CreateUnion( | 59 static PermissionSet* CreateUnion( |
60 const PermissionSet* set1, const PermissionSet* set2); | 60 const PermissionSet* set1, const PermissionSet* set2); |
61 | 61 |
62 // Creates a new permission set that only contains permissions that must be | |
63 // in the manifest. Passes ownership of the new set to the caller. | |
64 static PermissionSet* ExcludeNotInManifestPermissions( | |
65 const PermissionSet* set); | |
66 | |
67 bool operator==(const PermissionSet& rhs) const; | 62 bool operator==(const PermissionSet& rhs) const; |
68 | 63 |
69 // Returns true if |set| is a subset of this. | 64 // Returns true if |set| is a subset of this. |
70 bool Contains(const PermissionSet& set) const; | 65 bool Contains(const PermissionSet& set) const; |
71 | 66 |
72 // 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. |
73 std::set<std::string> GetAPIsAsStrings() const; | 68 std::set<std::string> GetAPIsAsStrings() const; |
74 | 69 |
75 // Returns whether this namespace has any functions which the extension has | 70 // Returns whether this namespace has any functions which the extension has |
76 // permission to use. For example, even though the extension may not have | 71 // permission to use. For example, even though the extension may not have |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 // TODO(jstritar): Rename to "user_script_hosts_"? | 192 // TODO(jstritar): Rename to "user_script_hosts_"? |
198 URLPatternSet scriptable_hosts_; | 193 URLPatternSet scriptable_hosts_; |
199 | 194 |
200 // The list of hosts this effectively grants access to. | 195 // The list of hosts this effectively grants access to. |
201 URLPatternSet effective_hosts_; | 196 URLPatternSet effective_hosts_; |
202 }; | 197 }; |
203 | 198 |
204 } // namespace extensions | 199 } // namespace extensions |
205 | 200 |
206 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_ | 201 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_ |
OLD | NEW |