Add policies to control power management on the Chrome OS login screen
[chromium-blink-merge.git] / chrome / browser / chromeos / policy / configuration_policy_handler_chromeos.h
blob9533d1d1b99eaedaf0524e0004d26b633c70c9be
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 "chrome/browser/policy/configuration_policy_handler.h"
9 #include "chromeos/network/network_ui_data.h"
10 #include "chromeos/network/onc/onc_constants.h"
12 namespace base {
13 class DictionaryValue;
14 class Value;
17 namespace policy {
19 // ConfigurationPolicyHandler for validation of the network configuration
20 // policies. These actually don't set any preferences, but the handler just
21 // generates error messages.
22 class NetworkConfigurationPolicyHandler : public TypeCheckingPolicyHandler {
23 public:
24 static NetworkConfigurationPolicyHandler* CreateForUserPolicy();
25 static NetworkConfigurationPolicyHandler* CreateForDevicePolicy();
27 virtual ~NetworkConfigurationPolicyHandler();
29 // ConfigurationPolicyHandler methods:
30 virtual bool CheckPolicySettings(const PolicyMap& policies,
31 PolicyErrorMap* errors) OVERRIDE;
32 virtual void ApplyPolicySettings(const PolicyMap& policies,
33 PrefValueMap* prefs) OVERRIDE;
34 virtual void PrepareForDisplaying(PolicyMap* policies) const OVERRIDE;
36 private:
37 explicit NetworkConfigurationPolicyHandler(
38 const char* policy_name,
39 chromeos::onc::ONCSource onc_source);
41 // Takes network policy in Value representation and produces an output Value
42 // that contains a pretty-printed and sanitized version. In particular, we
43 // remove any Passphrases that may be contained in the JSON. Ownership of the
44 // return value is transferred to the caller.
45 static base::Value* SanitizeNetworkConfig(const base::Value* config);
47 // The kind of ONC source that this handler represents. ONCSource
48 // distinguishes between user and device policy.
49 const chromeos::onc::ONCSource onc_source_;
51 DISALLOW_COPY_AND_ASSIGN(NetworkConfigurationPolicyHandler);
54 // Maps the PinnedLauncherApps policy to the corresponding pref.
55 class PinnedLauncherAppsPolicyHandler : public ExtensionListPolicyHandler {
56 public:
57 PinnedLauncherAppsPolicyHandler();
58 virtual ~PinnedLauncherAppsPolicyHandler();
60 // ExtensionListPolicyHandler methods:
61 virtual void ApplyPolicySettings(const PolicyMap& policies,
62 PrefValueMap* prefs) OVERRIDE;
64 private:
65 DISALLOW_COPY_AND_ASSIGN(PinnedLauncherAppsPolicyHandler);
68 class ScreenMagnifierPolicyHandler : public IntRangePolicyHandlerBase {
69 public:
70 ScreenMagnifierPolicyHandler();
71 virtual ~ScreenMagnifierPolicyHandler();
73 // IntRangePolicyHandlerBase:
74 virtual void ApplyPolicySettings(const PolicyMap& policies,
75 PrefValueMap* prefs) OVERRIDE;
77 private:
78 DISALLOW_COPY_AND_ASSIGN(ScreenMagnifierPolicyHandler);
81 // ConfigurationPolicyHandler for login screen power management settings. This
82 // does not actually set any prefs, it just checks whether the settings are
83 // valid and generates errors if appropriate.
84 class LoginScreenPowerManagementPolicyHandler
85 : public TypeCheckingPolicyHandler {
86 public:
87 LoginScreenPowerManagementPolicyHandler();
88 virtual ~LoginScreenPowerManagementPolicyHandler();
90 // TypeCheckingPolicyHandler:
91 virtual bool CheckPolicySettings(const PolicyMap& policies,
92 PolicyErrorMap* errors) OVERRIDE;
93 virtual void ApplyPolicySettings(const PolicyMap& policies,
94 PrefValueMap* prefs) OVERRIDE;
96 private:
97 DISALLOW_COPY_AND_ASSIGN(LoginScreenPowerManagementPolicyHandler);
100 } // namespace policy
102 #endif // CHROME_BROWSER_CHROMEOS_POLICY_CONFIGURATION_POLICY_HANDLER_CHROMEOS_H_