OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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 #include "chrome/browser/policy/configuration_policy_handler_chromeos.h" |
| 6 |
| 7 #include <string> |
| 8 |
| 9 #include "chrome/browser/chromeos/cros/onc_network_parser.h" |
| 10 #include "chrome/browser/policy/policy_error_map.h" |
| 11 #include "grit/generated_resources.h" |
| 12 |
| 13 namespace policy { |
| 14 |
| 15 NetworkConfigurationPolicyHandler::NetworkConfigurationPolicyHandler( |
| 16 ConfigurationPolicyType type) |
| 17 : TypeCheckingPolicyHandler(type, Value::TYPE_STRING) {} |
| 18 |
| 19 NetworkConfigurationPolicyHandler::~NetworkConfigurationPolicyHandler() {} |
| 20 |
| 21 bool NetworkConfigurationPolicyHandler::CheckPolicySettings( |
| 22 const PolicyMap* policies, |
| 23 PolicyErrorMap* errors) { |
| 24 const Value* value; |
| 25 if (!TypeCheckingPolicyHandler::CheckAndGetValue(policies, errors, &value)) |
| 26 return false; |
| 27 |
| 28 if (value) { |
| 29 std::string onc_blob; |
| 30 value->GetAsString(&onc_blob); |
| 31 chromeos::OncNetworkParser parser(onc_blob); |
| 32 if (!parser.parse_error().empty()) { |
| 33 errors->AddError(policy_type(), |
| 34 IDS_POLICY_NETWORK_CONFIG_PARSE_ERROR, |
| 35 parser.parse_error()); |
| 36 return false; |
| 37 } |
| 38 } |
| 39 |
| 40 return true; |
| 41 } |
| 42 |
| 43 void NetworkConfigurationPolicyHandler::ApplyPolicySettings( |
| 44 const PolicyMap* policies, |
| 45 PrefValueMap* prefs) {} |
| 46 |
| 47 } // namespace policy |
OLD | NEW |