| 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 #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" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 errors->AddError(policy_name(), IDS_POLICY_NETWORK_CONFIG_PARSE_FAILED); | 55 errors->AddError(policy_name(), IDS_POLICY_NETWORK_CONFIG_PARSE_FAILED); |
| 56 return false; | 56 return false; |
| 57 } | 57 } |
| 58 | 58 |
| 59 // Validate the ONC dictionary. We are liberal and ignore unknown field | 59 // Validate the ONC dictionary. We are liberal and ignore unknown field |
| 60 // names and ignore invalid field names in kRecommended arrays. | 60 // names and ignore invalid field names in kRecommended arrays. |
| 61 onc::Validator validator(false, // Ignore unknown fields. | 61 onc::Validator validator(false, // Ignore unknown fields. |
| 62 false, // Ignore invalid recommended field names. | 62 false, // Ignore invalid recommended field names. |
| 63 true, // Fail on missing fields. | 63 true, // Fail on missing fields. |
| 64 true); // Validate for managed ONC | 64 true); // Validate for managed ONC |
| 65 validator.SetOncSource(onc_source_); |
| 65 | 66 |
| 66 // ONC policies are always unencrypted. | 67 // ONC policies are always unencrypted. |
| 67 onc::Validator::Result validation_result; | 68 onc::Validator::Result validation_result; |
| 68 root_dict = validator.ValidateAndRepairObject( | 69 root_dict = validator.ValidateAndRepairObject( |
| 69 &onc::kToplevelConfigurationSignature, *root_dict, &validation_result); | 70 &onc::kToplevelConfigurationSignature, *root_dict, &validation_result); |
| 70 if (validation_result == onc::Validator::VALID_WITH_WARNINGS) { | 71 if (validation_result == onc::Validator::VALID_WITH_WARNINGS) { |
| 71 errors->AddError(policy_name(), | 72 errors->AddError(policy_name(), |
| 72 IDS_POLICY_NETWORK_CONFIG_IMPORT_PARTIAL); | 73 IDS_POLICY_NETWORK_CONFIG_IMPORT_PARTIAL); |
| 73 } else if (validation_result == onc::Validator::INVALID) { | 74 } else if (validation_result == onc::Validator::INVALID) { |
| 74 errors->AddError(policy_name(), IDS_POLICY_NETWORK_CONFIG_IMPORT_FAILED); | 75 errors->AddError(policy_name(), IDS_POLICY_NETWORK_CONFIG_IMPORT_FAILED); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 base::DictionaryValue* app_dict = new base::DictionaryValue(); | 196 base::DictionaryValue* app_dict = new base::DictionaryValue(); |
| 196 app_dict->SetString(ash::kPinnedAppsPrefAppIDPath, id); | 197 app_dict->SetString(ash::kPinnedAppsPrefAppIDPath, id); |
| 197 pinned_apps_list->Append(app_dict); | 198 pinned_apps_list->Append(app_dict); |
| 198 } | 199 } |
| 199 } | 200 } |
| 200 prefs->SetValue(pref_path(), pinned_apps_list); | 201 prefs->SetValue(pref_path(), pinned_apps_list); |
| 201 } | 202 } |
| 202 } | 203 } |
| 203 | 204 |
| 204 } // namespace policy | 205 } // namespace policy |
| OLD | NEW |