Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: chrome/browser/policy/configuration_policy_handler_chromeos.cc

Issue 11578052: Replace OncNetworkParser by the new ONC translator. (Closed) Base URL: http://git.chromium.org/chromium/src.git@extend_onc_to_shill
Patch Set: Rebased. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/onc_network_parser_unittest.cc ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698