| 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_BROWSER_MANAGEMENT_POLICY_H_ | 5 #ifndef EXTENSIONS_BROWSER_MANAGEMENT_POLICY_H_ |
| 6 #define EXTENSIONS_BROWSER_MANAGEMENT_POLICY_H_ | 6 #define EXTENSIONS_BROWSER_MANAGEMENT_POLICY_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 ManagementPolicy(); | 93 ManagementPolicy(); |
| 94 ~ManagementPolicy(); | 94 ~ManagementPolicy(); |
| 95 | 95 |
| 96 // Registers or unregisters a provider, causing it to be added to or removed | 96 // Registers or unregisters a provider, causing it to be added to or removed |
| 97 // from the list of providers queried. Ownership of the provider remains with | 97 // from the list of providers queried. Ownership of the provider remains with |
| 98 // the caller. Providers do not need to be unregistered on shutdown. | 98 // the caller. Providers do not need to be unregistered on shutdown. |
| 99 void RegisterProvider(Provider* provider); | 99 void RegisterProvider(Provider* provider); |
| 100 void UnregisterProvider(Provider* provider); | 100 void UnregisterProvider(Provider* provider); |
| 101 | 101 |
| 102 // Like RegisterProvider(), but registers multiple providers instead. | 102 // Like RegisterProvider(), but registers multiple providers instead. |
| 103 void RegisterProviders(std::vector<Provider*> providers); | 103 void RegisterProviders( |
| 104 const std::vector<std::unique_ptr<Provider>>& providers); |
| 104 | 105 |
| 105 // Returns true if the user is permitted to install, load, and run the given | 106 // Returns true if the user is permitted to install, load, and run the given |
| 106 // extension. If not, |error| may be set to an appropriate message. | 107 // extension. If not, |error| may be set to an appropriate message. |
| 107 // TODO(treib,pam): Misleading name; see comment in Provider. crbug.com/461747 | 108 // TODO(treib,pam): Misleading name; see comment in Provider. crbug.com/461747 |
| 108 bool UserMayLoad(const Extension* extension, base::string16* error) const; | 109 bool UserMayLoad(const Extension* extension, base::string16* error) const; |
| 109 | 110 |
| 110 // Returns true if the user is permitted to enable, disable, or uninstall the | 111 // Returns true if the user is permitted to enable, disable, or uninstall the |
| 111 // given extension, or change the extension's usage options (incognito mode, | 112 // given extension, or change the extension's usage options (incognito mode, |
| 112 // file access, etc.). If not, |error| may be set to an appropriate message. | 113 // file access, etc.). If not, |error| may be set to an appropriate message. |
| 113 // TODO(treib,pam): Misleading name; see comment in Provider. crbug.com/461747 | 114 // TODO(treib,pam): Misleading name; see comment in Provider. crbug.com/461747 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // the Provider objects in |providers_|. The return value of this function | 148 // the Provider objects in |providers_|. The return value of this function |
| 148 // will be |normal_result|, unless any of the Provider calls to |function| | 149 // will be |normal_result|, unless any of the Provider calls to |function| |
| 149 // return !normal_result, in which case this function will then early-return | 150 // return !normal_result, in which case this function will then early-return |
| 150 // !normal_result. | 151 // !normal_result. |
| 151 bool ApplyToProviderList(ProviderFunction function, | 152 bool ApplyToProviderList(ProviderFunction function, |
| 152 const char* debug_operation_name, | 153 const char* debug_operation_name, |
| 153 bool normal_result, | 154 bool normal_result, |
| 154 const Extension* extension, | 155 const Extension* extension, |
| 155 base::string16* error) const; | 156 base::string16* error) const; |
| 156 | 157 |
| 158 // This stores raw pointers to Provider. |
| 159 // TODO(lazyboy): Consider making ManagementPolicy own these providers. |
| 157 ProviderList providers_; | 160 ProviderList providers_; |
| 158 | 161 |
| 159 DISALLOW_COPY_AND_ASSIGN(ManagementPolicy); | 162 DISALLOW_COPY_AND_ASSIGN(ManagementPolicy); |
| 160 }; | 163 }; |
| 161 | 164 |
| 162 } // namespace extensions | 165 } // namespace extensions |
| 163 | 166 |
| 164 #endif // EXTENSIONS_BROWSER_MANAGEMENT_POLICY_H_ | 167 #endif // EXTENSIONS_BROWSER_MANAGEMENT_POLICY_H_ |
| OLD | NEW |