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