| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_POLICY_CONFIGURATION_POLICY_HANDLER_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_HANDLER_CHROMEOS_H_ |
| 6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_HANDLER_CHROMEOS_H_ | 6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_HANDLER_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/chromeos/cros/network_ui_data.h" | 8 #include "chrome/browser/chromeos/cros/network_ui_data.h" |
| 9 #include "chrome/browser/policy/configuration_policy_handler.h" | 9 #include "chrome/browser/policy/configuration_policy_handler.h" |
| 10 | 10 |
| 11 namespace base { |
| 12 class DictionaryValue; |
| 13 class Value; |
| 14 } |
| 15 |
| 11 namespace policy { | 16 namespace policy { |
| 12 | 17 |
| 13 // ConfigurationPolicyHandler for validation of the network configuration | 18 // ConfigurationPolicyHandler for validation of the network configuration |
| 14 // policies. These actually don't set any preferences, but the handler just | 19 // policies. These actually don't set any preferences, but the handler just |
| 15 // generates error messages. | 20 // generates error messages. |
| 16 class NetworkConfigurationPolicyHandler : public TypeCheckingPolicyHandler { | 21 class NetworkConfigurationPolicyHandler : public TypeCheckingPolicyHandler { |
| 17 public: | 22 public: |
| 18 NetworkConfigurationPolicyHandler( | 23 NetworkConfigurationPolicyHandler( |
| 19 const char* policy_name, | 24 const char* policy_name, |
| 20 chromeos::NetworkUIData::ONCSource onc_source); | 25 chromeos::NetworkUIData::ONCSource onc_source); |
| 21 virtual ~NetworkConfigurationPolicyHandler(); | 26 virtual ~NetworkConfigurationPolicyHandler(); |
| 22 | 27 |
| 23 // ConfigurationPolicyHandler methods: | 28 // ConfigurationPolicyHandler methods: |
| 24 virtual bool CheckPolicySettings(const PolicyMap& policies, | 29 virtual bool CheckPolicySettings(const PolicyMap& policies, |
| 25 PolicyErrorMap* errors) OVERRIDE; | 30 PolicyErrorMap* errors) OVERRIDE; |
| 26 virtual void ApplyPolicySettings(const PolicyMap& policies, | 31 virtual void ApplyPolicySettings(const PolicyMap& policies, |
| 27 PrefValueMap* prefs) OVERRIDE; | 32 PrefValueMap* prefs) OVERRIDE; |
| 28 virtual void PrepareForDisplaying(PolicyMap* policies) const OVERRIDE; | 33 virtual void PrepareForDisplaying(PolicyMap* policies) const OVERRIDE; |
| 29 | 34 |
| 30 private: | 35 private: |
| 31 // Takes network policy in Value representation and produces an output Value | 36 // Takes network policy in Value representation and produces an output Value |
| 32 // that contains a pretty-printed and sanitized version. In particular, we | 37 // that contains a pretty-printed and sanitized version. In particular, we |
| 33 // remove any Passphrases that may be contained in the JSON. Ownership of the | 38 // remove any Passphrases that may be contained in the JSON. Ownership of the |
| 34 // return value is transferred to the caller. | 39 // return value is transferred to the caller. |
| 35 static Value* SanitizeNetworkConfig(const Value* config); | 40 static base::Value* SanitizeNetworkConfig(const base::Value* config); |
| 36 | 41 |
| 37 // Filters a network dictionary to remove all sensitive fields and replace | 42 // Filters a network dictionary to remove all sensitive fields and replace |
| 38 // their values with placeholders. | 43 // their values with placeholders. |
| 39 static void StripSensitiveValues(DictionaryValue* network_dict); | 44 static void MaskSensitiveValues(base::DictionaryValue* network_dict); |
| 40 | 45 |
| 41 chromeos::NetworkUIData::ONCSource onc_source_; | 46 chromeos::NetworkUIData::ONCSource onc_source_; |
| 42 | 47 |
| 43 DISALLOW_COPY_AND_ASSIGN(NetworkConfigurationPolicyHandler); | 48 DISALLOW_COPY_AND_ASSIGN(NetworkConfigurationPolicyHandler); |
| 44 }; | 49 }; |
| 45 | 50 |
| 46 // Maps the PinnedLauncherApps policy to the corresponding pref. | 51 // Maps the PinnedLauncherApps policy to the corresponding pref. |
| 47 class PinnedLauncherAppsPolicyHandler : public ExtensionListPolicyHandler { | 52 class PinnedLauncherAppsPolicyHandler : public ExtensionListPolicyHandler { |
| 48 public: | 53 public: |
| 49 PinnedLauncherAppsPolicyHandler(); | 54 PinnedLauncherAppsPolicyHandler(); |
| 50 virtual ~PinnedLauncherAppsPolicyHandler(); | 55 virtual ~PinnedLauncherAppsPolicyHandler(); |
| 51 | 56 |
| 52 // ExtensionListPolicyHandler methods: | 57 // ExtensionListPolicyHandler methods: |
| 53 virtual void ApplyPolicySettings(const PolicyMap& policies, | 58 virtual void ApplyPolicySettings(const PolicyMap& policies, |
| 54 PrefValueMap* prefs) OVERRIDE; | 59 PrefValueMap* prefs) OVERRIDE; |
| 55 | 60 |
| 56 private: | 61 private: |
| 57 DISALLOW_COPY_AND_ASSIGN(PinnedLauncherAppsPolicyHandler); | 62 DISALLOW_COPY_AND_ASSIGN(PinnedLauncherAppsPolicyHandler); |
| 58 }; | 63 }; |
| 59 | 64 |
| 60 } // namespace policy | 65 } // namespace policy |
| 61 | 66 |
| 62 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_HANDLER_CHROMEOS_H_ | 67 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_HANDLER_CHROMEOS_H_ |
| OLD | NEW |