OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_BROWSER_EXTENSIONS_SCRIPTING_PERMISSIONS_MODIFIER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_SCRIPTING_PERMISSIONS_MODIFIER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_SCRIPTING_PERMISSIONS_MODIFIER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_SCRIPTING_PERMISSIONS_MODIFIER_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | |
11 | 12 |
12 class GURL; | 13 class GURL; |
13 | 14 |
14 namespace content { | 15 namespace content { |
15 class BrowserContext; | 16 class BrowserContext; |
16 } | 17 } |
17 | 18 |
18 namespace extensions { | 19 namespace extensions { |
19 class Extension; | 20 class Extension; |
20 class PermissionSet; | 21 class PermissionSet; |
(...skipping 29 matching lines...) Expand all Loading... |
50 void RemoveGrantedHostPermission(const GURL& url) const; | 51 void RemoveGrantedHostPermission(const GURL& url) const; |
51 | 52 |
52 // Takes in a set of permissions and withholds any permissions that should not | 53 // Takes in a set of permissions and withholds any permissions that should not |
53 // be granted, populating |granted_permissions_out| with the set of all | 54 // be granted, populating |granted_permissions_out| with the set of all |
54 // permissions that can be granted, and |withheld_permissions_out| with the | 55 // permissions that can be granted, and |withheld_permissions_out| with the |
55 // set of all withheld permissions. | 56 // set of all withheld permissions. |
56 // If |use_initial_state| is true, this will treat the extension as though it | 57 // If |use_initial_state| is true, this will treat the extension as though it |
57 // was just installed, not taking into account extra granted preferences. | 58 // was just installed, not taking into account extra granted preferences. |
58 void WithholdPermissions( | 59 void WithholdPermissions( |
59 const PermissionSet& permissions, | 60 const PermissionSet& permissions, |
60 scoped_ptr<const PermissionSet>* granted_permissions_out, | 61 std::unique_ptr<const PermissionSet>* granted_permissions_out, |
61 scoped_ptr<const PermissionSet>* withheld_permissions_out, | 62 std::unique_ptr<const PermissionSet>* withheld_permissions_out, |
62 bool use_initial_state) const; | 63 bool use_initial_state) const; |
63 | 64 |
64 // Grants any withheld all-hosts (or all-hosts-like) permissions. | 65 // Grants any withheld all-hosts (or all-hosts-like) permissions. |
65 void GrantWithheldImpliedAllHosts() const; | 66 void GrantWithheldImpliedAllHosts() const; |
66 | 67 |
67 // Revokes any granted all-hosts (or all-hosts-like) permissions. | 68 // Revokes any granted all-hosts (or all-hosts-like) permissions. |
68 void WithholdImpliedAllHosts() const; | 69 void WithholdImpliedAllHosts() const; |
69 | 70 |
70 private: | 71 private: |
71 content::BrowserContext* browser_context_; | 72 content::BrowserContext* browser_context_; |
72 | 73 |
73 scoped_refptr<const Extension> extension_; | 74 scoped_refptr<const Extension> extension_; |
74 | 75 |
75 DISALLOW_COPY_AND_ASSIGN(ScriptingPermissionsModifier); | 76 DISALLOW_COPY_AND_ASSIGN(ScriptingPermissionsModifier); |
76 }; | 77 }; |
77 | 78 |
78 } // namespace extensions | 79 } // namespace extensions |
79 | 80 |
80 #endif // CHROME_BROWSER_EXTENSIONS_SCRIPTING_PERMISSIONS_MODIFIER_H_ | 81 #endif // CHROME_BROWSER_EXTENSIONS_SCRIPTING_PERMISSIONS_MODIFIER_H_ |
OLD | NEW |