| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_SET_H_ | 5 #ifndef EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_SET_H_ |
| 6 #define EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_SET_H_ | 6 #define EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_SET_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // permissions, manifest key permissions, host permissions, and scriptable | 35 // permissions, manifest key permissions, host permissions, and scriptable |
| 36 // hosts. The effective hosts of the newly created permission set will be | 36 // hosts. The effective hosts of the newly created permission set will be |
| 37 // inferred from the given host permissions. | 37 // inferred from the given host permissions. |
| 38 PermissionSet(const APIPermissionSet& apis, | 38 PermissionSet(const APIPermissionSet& apis, |
| 39 const ManifestPermissionSet& manifest_permissions, | 39 const ManifestPermissionSet& manifest_permissions, |
| 40 const URLPatternSet& explicit_hosts, | 40 const URLPatternSet& explicit_hosts, |
| 41 const URLPatternSet& scriptable_hosts); | 41 const URLPatternSet& scriptable_hosts); |
| 42 ~PermissionSet(); | 42 ~PermissionSet(); |
| 43 | 43 |
| 44 // Creates a new permission set equal to |set1| - |set2|. | 44 // Creates a new permission set equal to |set1| - |set2|. |
| 45 static scoped_ptr<const PermissionSet> CreateDifference( | 45 static std::unique_ptr<const PermissionSet> CreateDifference( |
| 46 const PermissionSet& set1, | 46 const PermissionSet& set1, |
| 47 const PermissionSet& set2); | 47 const PermissionSet& set2); |
| 48 | 48 |
| 49 // Creates a new permission set equal to the intersection of |set1| and | 49 // Creates a new permission set equal to the intersection of |set1| and |
| 50 // |set2|. | 50 // |set2|. |
| 51 static scoped_ptr<const PermissionSet> CreateIntersection( | 51 static std::unique_ptr<const PermissionSet> CreateIntersection( |
| 52 const PermissionSet& set1, | 52 const PermissionSet& set1, |
| 53 const PermissionSet& set2); | 53 const PermissionSet& set2); |
| 54 | 54 |
| 55 // Creates a new permission set equal to the union of |set1| and |set2|. | 55 // Creates a new permission set equal to the union of |set1| and |set2|. |
| 56 static scoped_ptr<const PermissionSet> CreateUnion(const PermissionSet& set1, | 56 static std::unique_ptr<const PermissionSet> CreateUnion( |
| 57 const PermissionSet& set2); | 57 const PermissionSet& set1, |
| 58 const PermissionSet& set2); |
| 58 | 59 |
| 59 bool operator==(const PermissionSet& rhs) const; | 60 bool operator==(const PermissionSet& rhs) const; |
| 60 bool operator!=(const PermissionSet& rhs) const; | 61 bool operator!=(const PermissionSet& rhs) const; |
| 61 | 62 |
| 62 // Returns a copy of this PermissionSet. | 63 // Returns a copy of this PermissionSet. |
| 63 scoped_ptr<const PermissionSet> Clone() const; | 64 std::unique_ptr<const PermissionSet> Clone() const; |
| 64 | 65 |
| 65 // Returns true if every API or host permission available to |set| is also | 66 // Returns true if every API or host permission available to |set| is also |
| 66 // available to this. In other words, if the API permissions of |set| are a | 67 // available to this. In other words, if the API permissions of |set| are a |
| 67 // subset of this, and the host permissions in this encompass those in |set|. | 68 // subset of this, and the host permissions in this encompass those in |set|. |
| 68 bool Contains(const PermissionSet& set) const; | 69 bool Contains(const PermissionSet& set) const; |
| 69 | 70 |
| 70 // Gets the API permissions in this set as a set of strings. | 71 // Gets the API permissions in this set as a set of strings. |
| 71 std::set<std::string> GetAPIsAsStrings() const; | 72 std::set<std::string> GetAPIsAsStrings() const; |
| 72 | 73 |
| 73 // Returns true if this is an empty set (e.g., the default permission set). | 74 // Returns true if this is an empty set (e.g., the default permission set). |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // Cache whether this set implies access to all hosts, because it's | 167 // Cache whether this set implies access to all hosts, because it's |
| 167 // non-trivial to compute (lazily initialized). | 168 // non-trivial to compute (lazily initialized). |
| 168 mutable ShouldWarnAllHostsType should_warn_all_hosts_; | 169 mutable ShouldWarnAllHostsType should_warn_all_hosts_; |
| 169 | 170 |
| 170 DISALLOW_ASSIGN(PermissionSet); | 171 DISALLOW_ASSIGN(PermissionSet); |
| 171 }; | 172 }; |
| 172 | 173 |
| 173 } // namespace extensions | 174 } // namespace extensions |
| 174 | 175 |
| 175 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_SET_H_ | 176 #endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_SET_H_ |
| OLD | NEW |