[email protected] | fdd679b | 2012-11-15 20:49:39 | [diff] [blame] | 1 | // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROME_BROWSER_EXTENSIONS_STANDARD_MANAGEMENT_POLICY_PROVIDER_H_ |
| 6 | #define CHROME_BROWSER_EXTENSIONS_STANDARD_MANAGEMENT_POLICY_PROVIDER_H_ |
| 7 | |
binjin | 8e3d018 | 2014-12-04 16:44:28 | [diff] [blame] | 8 | #include <string> |
| 9 | |
| 10 | #include "base/strings/string16.h" |
[email protected] | 301116c6 | 2013-11-26 10:37:45 | [diff] [blame] | 11 | #include "extensions/browser/management_policy.h" |
[email protected] | fdd679b | 2012-11-15 20:49:39 | [diff] [blame] | 12 | |
| 13 | namespace extensions { |
| 14 | |
[email protected] | fdd679b | 2012-11-15 20:49:39 | [diff] [blame] | 15 | class Extension; |
binjin | 1569c9b | 2014-09-05 13:33:18 | [diff] [blame] | 16 | class ExtensionManagement; |
[email protected] | fdd679b | 2012-11-15 20:49:39 | [diff] [blame] | 17 | |
| 18 | // The standard management policy provider, which takes into account the |
Alex Danilo | a8ed617 | 2020-09-15 12:03:04 | [diff] [blame] | 19 | // extension block/allowlists and admin block/allowlists. |
[email protected] | fdd679b | 2012-11-15 20:49:39 | [diff] [blame] | 20 | class StandardManagementPolicyProvider : public ManagementPolicy::Provider { |
| 21 | public: |
binjin | 1569c9b | 2014-09-05 13:33:18 | [diff] [blame] | 22 | explicit StandardManagementPolicyProvider( |
| 23 | const ExtensionManagement* settings); |
[email protected] | fdd679b | 2012-11-15 20:49:39 | [diff] [blame] | 24 | |
dcheng | ae36a4a | 2014-10-21 12:36:36 | [diff] [blame] | 25 | ~StandardManagementPolicyProvider() override; |
[email protected] | fdd679b | 2012-11-15 20:49:39 | [diff] [blame] | 26 | |
| 27 | // ManagementPolicy::Provider implementation. |
dcheng | ae36a4a | 2014-10-21 12:36:36 | [diff] [blame] | 28 | std::string GetDebugPolicyProviderName() const override; |
| 29 | bool UserMayLoad(const Extension* extension, |
| 30 | base::string16* error) const override; |
Devlin Cronin | ae9baf56 | 2018-11-15 22:10:04 | [diff] [blame] | 31 | bool UserMayInstall(const Extension* extension, |
| 32 | base::string16* error) const override; |
dcheng | ae36a4a | 2014-10-21 12:36:36 | [diff] [blame] | 33 | bool UserMayModifySettings(const Extension* extension, |
| 34 | base::string16* error) const override; |
Ivan Sandrk | 4a55dc2 | 2018-05-17 18:14:48 | [diff] [blame] | 35 | bool ExtensionMayModifySettings(const Extension* source_extension, |
| 36 | const Extension* extension, |
| 37 | base::string16* error) const override; |
dcheng | ae36a4a | 2014-10-21 12:36:36 | [diff] [blame] | 38 | bool MustRemainEnabled(const Extension* extension, |
| 39 | base::string16* error) const override; |
binjin | 8e3d018 | 2014-12-04 16:44:28 | [diff] [blame] | 40 | bool MustRemainDisabled(const Extension* extension, |
Minh X. Nguyen | 4547901 | 2017-08-18 21:35:36 | [diff] [blame] | 41 | disable_reason::DisableReason* reason, |
binjin | 8e3d018 | 2014-12-04 16:44:28 | [diff] [blame] | 42 | base::string16* error) const override; |
dcheng | ae36a4a | 2014-10-21 12:36:36 | [diff] [blame] | 43 | bool MustRemainInstalled(const Extension* extension, |
mostynb | a15bee1 | 2014-10-04 00:40:32 | [diff] [blame] | 44 | base::string16* error) const override; |
Alexander Nohe | 2c540288 | 2019-04-11 21:56:33 | [diff] [blame] | 45 | bool ShouldForceUninstall(const Extension* extension, |
| 46 | base::string16* error) const override; |
[email protected] | fdd679b | 2012-11-15 20:49:39 | [diff] [blame] | 47 | |
| 48 | private: |
binjin | 1569c9b | 2014-09-05 13:33:18 | [diff] [blame] | 49 | const ExtensionManagement* settings_; |
nrpeter | 2362e7e | 2017-05-10 17:21:26 | [diff] [blame] | 50 | bool ReturnLoadError(const extensions::Extension* extension, |
| 51 | base::string16* error) const; |
[email protected] | fdd679b | 2012-11-15 20:49:39 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | } // namespace extensions |
| 55 | |
| 56 | #endif // CHROME_BROWSER_EXTENSIONS_STANDARD_MANAGEMENT_POLICY_PROVIDER_H_ |