configuration_policy_handler_chromeos.h revision 2a99a7e74a7f215066514fe81d2bfa6639d9eddd
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. 4 5#ifndef CHROME_BROWSER_CHROMEOS_POLICY_CONFIGURATION_POLICY_HANDLER_CHROMEOS_H_ 6#define CHROME_BROWSER_CHROMEOS_POLICY_CONFIGURATION_POLICY_HANDLER_CHROMEOS_H_ 7 8#include "chrome/browser/chromeos/cros/network_ui_data.h" 9#include "chrome/browser/policy/configuration_policy_handler.h" 10#include "chromeos/network/onc/onc_constants.h" 11 12namespace base { 13class DictionaryValue; 14class Value; 15} 16 17namespace policy { 18 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. 22class NetworkConfigurationPolicyHandler : public TypeCheckingPolicyHandler { 23 public: 24 NetworkConfigurationPolicyHandler( 25 const char* policy_name, 26 chromeos::onc::ONCSource onc_source); 27 virtual ~NetworkConfigurationPolicyHandler(); 28 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; 35 36 private: 37 // Takes network policy in Value representation and produces an output Value 38 // that contains a pretty-printed and sanitized version. In particular, we 39 // remove any Passphrases that may be contained in the JSON. Ownership of the 40 // return value is transferred to the caller. 41 static base::Value* SanitizeNetworkConfig(const base::Value* config); 42 43 // Filters a network dictionary to remove all sensitive fields and replace 44 // their values with placeholders. 45 static void MaskSensitiveValues(base::DictionaryValue* network_dict); 46 47 chromeos::onc::ONCSource onc_source_; 48 49 DISALLOW_COPY_AND_ASSIGN(NetworkConfigurationPolicyHandler); 50}; 51 52// Maps the PinnedLauncherApps policy to the corresponding pref. 53class PinnedLauncherAppsPolicyHandler : public ExtensionListPolicyHandler { 54 public: 55 PinnedLauncherAppsPolicyHandler(); 56 virtual ~PinnedLauncherAppsPolicyHandler(); 57 58 // ExtensionListPolicyHandler methods: 59 virtual void ApplyPolicySettings(const PolicyMap& policies, 60 PrefValueMap* prefs) OVERRIDE; 61 62 private: 63 DISALLOW_COPY_AND_ASSIGN(PinnedLauncherAppsPolicyHandler); 64}; 65 66} // namespace policy 67 68#endif // CHROME_BROWSER_CHROMEOS_POLICY_CONFIGURATION_POLICY_HANDLER_CHROMEOS_H_ 69