OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/browser/policy/configuration_policy_handler_chromeos.h" | 5 #include "chrome/browser/policy/configuration_policy_handler_chromeos.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "chrome/browser/chromeos/cros/onc_network_parser.h" | 13 #include "chrome/browser/chromeos/cros/onc_network_parser.h" |
14 #include "chrome/browser/policy/policy_error_map.h" | 14 #include "chrome/browser/policy/policy_error_map.h" |
15 #include "chrome/browser/policy/policy_map.h" | 15 #include "chrome/browser/policy/policy_map.h" |
16 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
17 | 17 |
18 namespace policy { | 18 namespace policy { |
19 | 19 |
20 NetworkConfigurationPolicyHandler::NetworkConfigurationPolicyHandler( | 20 NetworkConfigurationPolicyHandler::NetworkConfigurationPolicyHandler( |
21 ConfigurationPolicyType type) | 21 ConfigurationPolicyType type, |
22 : TypeCheckingPolicyHandler(type, Value::TYPE_STRING) {} | 22 chromeos::NetworkUIData::ONCSource onc_source) |
| 23 : TypeCheckingPolicyHandler(type, Value::TYPE_STRING), |
| 24 onc_source_(onc_source) {} |
23 | 25 |
24 NetworkConfigurationPolicyHandler::~NetworkConfigurationPolicyHandler() {} | 26 NetworkConfigurationPolicyHandler::~NetworkConfigurationPolicyHandler() {} |
25 | 27 |
26 bool NetworkConfigurationPolicyHandler::CheckPolicySettings( | 28 bool NetworkConfigurationPolicyHandler::CheckPolicySettings( |
27 const PolicyMap& policies, | 29 const PolicyMap& policies, |
28 PolicyErrorMap* errors) { | 30 PolicyErrorMap* errors) { |
29 const Value* value; | 31 const Value* value; |
30 if (!CheckAndGetValue(policies, errors, &value)) | 32 if (!CheckAndGetValue(policies, errors, &value)) |
31 return false; | 33 return false; |
32 | 34 |
33 if (value) { | 35 if (value) { |
34 std::string onc_blob; | 36 std::string onc_blob; |
35 value->GetAsString(&onc_blob); | 37 value->GetAsString(&onc_blob); |
36 chromeos::OncNetworkParser parser(onc_blob); | 38 chromeos::OncNetworkParser parser(onc_blob, onc_source_); |
37 if (!parser.parse_error().empty()) { | 39 if (!parser.parse_error().empty()) { |
38 errors->AddError(policy_type(), | 40 errors->AddError(policy_type(), |
39 IDS_POLICY_NETWORK_CONFIG_PARSE_ERROR, | 41 IDS_POLICY_NETWORK_CONFIG_PARSE_ERROR, |
40 parser.parse_error()); | 42 parser.parse_error()); |
41 return false; | 43 return false; |
42 } | 44 } |
43 } | 45 } |
44 | 46 |
45 return true; | 47 return true; |
46 } | 48 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 117 |
116 for (size_t i = 0; i < arraysize(kFilteredSettings); ++i) { | 118 for (size_t i = 0; i < arraysize(kFilteredSettings); ++i) { |
117 if (network_dict->Remove(kFilteredSettings[i], NULL)) { | 119 if (network_dict->Remove(kFilteredSettings[i], NULL)) { |
118 network_dict->Set(kFilteredSettings[i], | 120 network_dict->Set(kFilteredSettings[i], |
119 Value::CreateStringValue(kPlaceholder)); | 121 Value::CreateStringValue(kPlaceholder)); |
120 } | 122 } |
121 } | 123 } |
122 } | 124 } |
123 | 125 |
124 } // namespace policy | 126 } // namespace policy |
OLD | NEW |