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 |
62 bool operator==(const PermissionSet& rhs) const; | 67 bool operator==(const PermissionSet& rhs) const; |
63 | 68 |
64 // Returns true if |set| is a subset of this. | 69 // Returns true if |set| is a subset of this. |
65 bool Contains(const PermissionSet& set) const; | 70 bool Contains(const PermissionSet& set) const; |
66 | 71 |
67 // Gets the API permissions in this set as a set of strings. | 72 // Gets the API permissions in this set as a set of strings. |
68 std::set<std::string> GetAPIsAsStrings() const; | 73 std::set<std::string> GetAPIsAsStrings() const; |
69 | 74 |
70 // Returns whether this namespace has any functions which the extension has | 75 // Returns whether this namespace has any functions which the extension has |
71 // 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 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // TODO(jstritar): Rename to "user_script_hosts_"? | 197 // TODO(jstritar): Rename to "user_script_hosts_"? |
193 URLPatternSet scriptable_hosts_; | 198 URLPatternSet scriptable_hosts_; |
194 | 199 |
195 // The list of hosts this effectively grants access to. | 200 // The list of hosts this effectively grants access to. |
196 URLPatternSet effective_hosts_; | 201 URLPatternSet effective_hosts_; |
197 }; | 202 }; |
198 | 203 |
199 } // namespace extensions | 204 } // namespace extensions |
200 | 205 |
201 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_ | 206 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_ |
OLD | NEW |