Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / chromeos / policy / configuration_policy_handler_chromeos.h
blob1eb90d59f01df333e8d46a554744779791240c17
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_CONFIGURATION_POLICY_HANDLER_CHROMEOS_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_CONFIGURATION_POLICY_HANDLER_CHROMEOS_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "chrome/browser/extensions/policy_handlers.h"
11 #include "chromeos/network/network_ui_data.h"
12 #include "components/onc/onc_constants.h"
13 #include "components/policy/core/browser/configuration_policy_handler.h"
15 namespace base {
16 class DictionaryValue;
17 class Value;
20 namespace policy {
22 class Schema;
24 // ConfigurationPolicyHandler for policies referencing external data.
25 class ExternalDataPolicyHandler : public TypeCheckingPolicyHandler {
26 public:
27 explicit ExternalDataPolicyHandler(const char* policy_name);
28 ~ExternalDataPolicyHandler() override;
30 // TypeCheckingPolicyHandler:
31 bool CheckPolicySettings(const PolicyMap& policies,
32 PolicyErrorMap* errors) override;
34 void ApplyPolicySettings(const PolicyMap& policies,
35 PrefValueMap* prefs) override;
37 private:
38 DISALLOW_COPY_AND_ASSIGN(ExternalDataPolicyHandler);
41 // ConfigurationPolicyHandler for validation of the network configuration
42 // policies. These actually don't set any preferences, but the handler just
43 // generates error messages.
44 class NetworkConfigurationPolicyHandler : public TypeCheckingPolicyHandler {
45 public:
46 static NetworkConfigurationPolicyHandler* CreateForUserPolicy();
47 static NetworkConfigurationPolicyHandler* CreateForDevicePolicy();
49 ~NetworkConfigurationPolicyHandler() override;
51 // ConfigurationPolicyHandler methods:
52 bool CheckPolicySettings(const PolicyMap& policies,
53 PolicyErrorMap* errors) override;
54 void ApplyPolicySettings(const PolicyMap& policies,
55 PrefValueMap* prefs) override;
56 void PrepareForDisplaying(PolicyMap* policies) const override;
58 private:
59 explicit NetworkConfigurationPolicyHandler(
60 const char* policy_name,
61 ::onc::ONCSource onc_source,
62 const char* pref_path);
64 // Takes network policy in Value representation and produces an output Value
65 // that contains a pretty-printed and sanitized version. In particular, we
66 // remove any Passphrases that may be contained in the JSON. Ownership of the
67 // return value is transferred to the caller.
68 static base::Value* SanitizeNetworkConfig(const base::Value* config);
70 // The kind of ONC source that this handler represents. ONCSource
71 // distinguishes between user and device policy.
72 const ::onc::ONCSource onc_source_;
74 // The name of the pref to apply the policy to.
75 const char* pref_path_;
77 DISALLOW_COPY_AND_ASSIGN(NetworkConfigurationPolicyHandler);
80 // Maps the PinnedLauncherApps policy to the corresponding pref.
81 class PinnedLauncherAppsPolicyHandler
82 : public extensions::ExtensionListPolicyHandler {
83 public:
84 PinnedLauncherAppsPolicyHandler();
85 ~PinnedLauncherAppsPolicyHandler() override;
87 // ExtensionListPolicyHandler methods:
88 void ApplyPolicySettings(const PolicyMap& policies,
89 PrefValueMap* prefs) override;
91 private:
92 DISALLOW_COPY_AND_ASSIGN(PinnedLauncherAppsPolicyHandler);
95 class ScreenMagnifierPolicyHandler : public IntRangePolicyHandlerBase {
96 public:
97 ScreenMagnifierPolicyHandler();
98 ~ScreenMagnifierPolicyHandler() override;
100 // IntRangePolicyHandlerBase:
101 void ApplyPolicySettings(const PolicyMap& policies,
102 PrefValueMap* prefs) override;
104 private:
105 DISALLOW_COPY_AND_ASSIGN(ScreenMagnifierPolicyHandler);
108 // Policy handler for login screen power management settings. This does not
109 // actually set any prefs, it just checks whether the settings are valid and
110 // generates errors if appropriate.
111 class LoginScreenPowerManagementPolicyHandler
112 : public SchemaValidatingPolicyHandler {
113 public:
114 explicit LoginScreenPowerManagementPolicyHandler(const Schema& chrome_schema);
115 ~LoginScreenPowerManagementPolicyHandler() override;
117 // SchemaValidatingPolicyHandler:
118 void ApplyPolicySettings(const PolicyMap& policies,
119 PrefValueMap* prefs) override;
121 private:
122 DISALLOW_COPY_AND_ASSIGN(LoginScreenPowerManagementPolicyHandler);
125 // Handles the deprecated IdleAction policy, so both kIdleActionBattery and
126 // kIdleActionAC fall back to the deprecated action.
127 class DeprecatedIdleActionHandler : public IntRangePolicyHandlerBase {
128 public:
129 DeprecatedIdleActionHandler();
130 ~DeprecatedIdleActionHandler() override;
132 // ConfigurationPolicyHandler methods:
133 void ApplyPolicySettings(const PolicyMap& policies,
134 PrefValueMap* prefs) override;
136 private:
137 DISALLOW_COPY_AND_ASSIGN(DeprecatedIdleActionHandler);
140 class PowerManagementIdleSettingsPolicyHandler
141 : public SchemaValidatingPolicyHandler {
142 public:
143 explicit PowerManagementIdleSettingsPolicyHandler(
144 const Schema& chrome_schema);
145 ~PowerManagementIdleSettingsPolicyHandler() override;
147 // SchemaValidatingPolicyHandler:
148 void ApplyPolicySettings(const PolicyMap& policies,
149 PrefValueMap* prefs) override;
151 private:
152 DISALLOW_COPY_AND_ASSIGN(PowerManagementIdleSettingsPolicyHandler);
155 class ScreenLockDelayPolicyHandler : public SchemaValidatingPolicyHandler {
156 public:
157 explicit ScreenLockDelayPolicyHandler(const Schema& chrome_schema);
158 ~ScreenLockDelayPolicyHandler() override;
160 // SchemaValidatingPolicyHandler:
161 void ApplyPolicySettings(const PolicyMap& policies,
162 PrefValueMap* prefs) override;
164 private:
165 DISALLOW_COPY_AND_ASSIGN(ScreenLockDelayPolicyHandler);
168 } // namespace policy
170 #endif // CHROME_BROWSER_CHROMEOS_POLICY_CONFIGURATION_POLICY_HANDLER_CHROMEOS_H_