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

Side by Side Diff: chromeos/network/managed_network_configuration_handler_impl.cc

Issue 694533007: Add 'setProperties' to InternetOptionsHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chromeos/network/managed_network_configuration_handler_impl.h" 5 #include "chromeos/network/managed_network_configuration_handler_impl.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 12 matching lines...) Expand all
23 #include "chromeos/network/network_device_handler.h" 23 #include "chromeos/network/network_device_handler.h"
24 #include "chromeos/network/network_event_log.h" 24 #include "chromeos/network/network_event_log.h"
25 #include "chromeos/network/network_policy_observer.h" 25 #include "chromeos/network/network_policy_observer.h"
26 #include "chromeos/network/network_profile.h" 26 #include "chromeos/network/network_profile.h"
27 #include "chromeos/network/network_profile_handler.h" 27 #include "chromeos/network/network_profile_handler.h"
28 #include "chromeos/network/network_state.h" 28 #include "chromeos/network/network_state.h"
29 #include "chromeos/network/network_state_handler.h" 29 #include "chromeos/network/network_state_handler.h"
30 #include "chromeos/network/network_ui_data.h" 30 #include "chromeos/network/network_ui_data.h"
31 #include "chromeos/network/onc/onc_merger.h" 31 #include "chromeos/network/onc/onc_merger.h"
32 #include "chromeos/network/onc/onc_signature.h" 32 #include "chromeos/network/onc/onc_signature.h"
33 #include "chromeos/network/onc/onc_translation_tables.h"
33 #include "chromeos/network/onc/onc_translator.h" 34 #include "chromeos/network/onc/onc_translator.h"
34 #include "chromeos/network/onc/onc_validator.h" 35 #include "chromeos/network/onc/onc_validator.h"
35 #include "chromeos/network/policy_util.h" 36 #include "chromeos/network/policy_util.h"
36 #include "chromeos/network/shill_property_util.h" 37 #include "chromeos/network/shill_property_util.h"
37 #include "components/onc/onc_constants.h" 38 #include "components/onc/onc_constants.h"
38 #include "third_party/cros_system_api/dbus/service_constants.h" 39 #include "third_party/cros_system_api/dbus/service_constants.h"
39 40
40 namespace chromeos { 41 namespace chromeos {
41 42
42 namespace { 43 namespace {
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 259
259 VLOG(2) << "SetProperties: Found GUID " << guid << " and profile " 260 VLOG(2) << "SetProperties: Found GUID " << guid << " and profile "
260 << profile->ToDebugString(); 261 << profile->ToDebugString();
261 262
262 const Policies* policies = GetPoliciesForProfile(*profile); 263 const Policies* policies = GetPoliciesForProfile(*profile);
263 if (!policies) { 264 if (!policies) {
264 InvokeErrorCallback(service_path, error_callback, kPoliciesNotInitialized); 265 InvokeErrorCallback(service_path, error_callback, kPoliciesNotInitialized);
265 return; 266 return;
266 } 267 }
267 268
269 // We need to ensure that required configuration properties (e.g. Type) are
270 // included for ONC validation.
271 scoped_ptr<base::DictionaryValue> user_settings_copy(
272 network_util::TranslateNetworkConfigurationStateToONC(state));
pneubeck (no reviews) 2014/11/11 16:09:31 I think this is solution is not ideal yet. We need
stevenjb 2014/11/12 01:23:29 Hmm. I don't like the idea of forcing the UI to sp
pneubeck (no reviews) 2014/11/13 17:38:56 Just looked at the validator, and I actually think
273 user_settings_copy->MergeDictionary(&user_settings);
274
268 // Validate the ONC dictionary. We are liberal and ignore unknown field 275 // Validate the ONC dictionary. We are liberal and ignore unknown field
269 // names. User settings are only partial ONC, thus we ignore missing fields. 276 // names. User settings are only partial ONC, thus we ignore missing fields.
270 onc::Validator validator(false, // Ignore unknown fields. 277 onc::Validator validator(false, // Ignore unknown fields.
271 false, // Ignore invalid recommended field names. 278 false, // Ignore invalid recommended field names.
272 false, // Ignore missing fields. 279 false, // Ignore missing fields.
273 false); // This ONC does not come from policy. 280 false); // This ONC does not come from policy.
274 281
275 onc::Validator::Result validation_result; 282 onc::Validator::Result validation_result;
276 scoped_ptr<base::DictionaryValue> validated_user_settings = 283 scoped_ptr<base::DictionaryValue> validated_user_settings =
277 validator.ValidateAndRepairObject( 284 validator.ValidateAndRepairObject(
278 &onc::kNetworkConfigurationSignature, 285 &onc::kNetworkConfigurationSignature,
279 user_settings, 286 *user_settings_copy,
280 &validation_result); 287 &validation_result);
281 288
282 if (validation_result == onc::Validator::INVALID) { 289 if (validation_result == onc::Validator::INVALID) {
283 InvokeErrorCallback(service_path, error_callback, kInvalidUserSettings); 290 InvokeErrorCallback(service_path, error_callback, kInvalidUserSettings);
284 return; 291 return;
285 } 292 }
286 if (validation_result == onc::Validator::VALID_WITH_WARNINGS) 293 if (validation_result == onc::Validator::VALID_WITH_WARNINGS)
287 LOG(WARNING) << "Validation of ONC user settings produced warnings."; 294 LOG(WARNING) << "Validation of ONC user settings produced warnings.";
288 295
289 const base::DictionaryValue* network_policy = 296 const base::DictionaryValue* network_policy =
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 scoped_ptr<base::DictionaryValue> network_properties, 765 scoped_ptr<base::DictionaryValue> network_properties,
759 GetDevicePropertiesCallback send_callback, 766 GetDevicePropertiesCallback send_callback,
760 const std::string& error_name, 767 const std::string& error_name,
761 scoped_ptr<base::DictionaryValue> error_data) { 768 scoped_ptr<base::DictionaryValue> error_data) {
762 NET_LOG_ERROR("Error getting device properties", service_path); 769 NET_LOG_ERROR("Error getting device properties", service_path);
763 send_callback.Run(service_path, network_properties.Pass()); 770 send_callback.Run(service_path, network_properties.Pass());
764 } 771 }
765 772
766 773
767 } // namespace chromeos 774 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698