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

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

Issue 759663004: ONC: add support for non-utf-8 SSIDs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: adjusted onc_spec.html Created 6 years 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 14 matching lines...) Expand all
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/network_util.h" 31 #include "chromeos/network/network_util.h"
32 #include "chromeos/network/onc/onc_merger.h" 32 #include "chromeos/network/onc/onc_merger.h"
33 #include "chromeos/network/onc/onc_signature.h" 33 #include "chromeos/network/onc/onc_signature.h"
34 #include "chromeos/network/onc/onc_translator.h" 34 #include "chromeos/network/onc/onc_translator.h"
35 #include "chromeos/network/onc/onc_utils.h"
35 #include "chromeos/network/onc/onc_validator.h" 36 #include "chromeos/network/onc/onc_validator.h"
36 #include "chromeos/network/policy_util.h" 37 #include "chromeos/network/policy_util.h"
37 #include "chromeos/network/shill_property_util.h" 38 #include "chromeos/network/shill_property_util.h"
38 #include "components/onc/onc_constants.h" 39 #include "components/onc/onc_constants.h"
39 #include "third_party/cros_system_api/dbus/service_constants.h" 40 #include "third_party/cros_system_api/dbus/service_constants.h"
40 41
41 namespace chromeos { 42 namespace chromeos {
42 43
43 namespace { 44 namespace {
44 45
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 false, // Ignore missing fields. 283 false, // Ignore missing fields.
283 false); // This ONC does not come from policy. 284 false); // This ONC does not come from policy.
284 285
285 onc::Validator::Result validation_result; 286 onc::Validator::Result validation_result;
286 scoped_ptr<base::DictionaryValue> validated_user_settings = 287 scoped_ptr<base::DictionaryValue> validated_user_settings =
287 validator.ValidateAndRepairObject( 288 validator.ValidateAndRepairObject(
288 &onc::kNetworkConfigurationSignature, 289 &onc::kNetworkConfigurationSignature,
289 *user_settings_copy, 290 *user_settings_copy,
290 &validation_result); 291 &validation_result);
291 292
293 // fill in HexSSID field from contents of SSID field if not set already
294 if (user_settings_copy.get() != NULL)
pneubeck (no reviews) 2014/11/27 14:49:02 nit: no .get()!=NULL and missing braces if (user_
cschuet (SLOW) 2014/11/27 15:44:30 Done.
295 onc::FillInHexSSIDFieldsInOncObject(
296 onc::kToplevelConfigurationSignature, user_settings_copy.get());
pneubeck (no reviews) 2014/11/27 14:49:02 bug: user_settings_copy -> validated_user_settings
cschuet (SLOW) 2014/11/27 15:44:30 Acknowledged.
297
298
292 if (validation_result == onc::Validator::INVALID) { 299 if (validation_result == onc::Validator::INVALID) {
293 InvokeErrorCallback(service_path, error_callback, kInvalidUserSettings); 300 InvokeErrorCallback(service_path, error_callback, kInvalidUserSettings);
294 return; 301 return;
295 } 302 }
296 if (validation_result == onc::Validator::VALID_WITH_WARNINGS) 303 if (validation_result == onc::Validator::VALID_WITH_WARNINGS)
297 LOG(WARNING) << "Validation of ONC user settings produced warnings."; 304 LOG(WARNING) << "Validation of ONC user settings produced warnings.";
298 305
299 const base::DictionaryValue* network_policy = 306 const base::DictionaryValue* network_policy =
300 GetByGUID(policies->per_network_config, guid); 307 GetByGUID(policies->per_network_config, guid);
301 VLOG(2) << "This configuration is " << (network_policy ? "" : "not ") 308 VLOG(2) << "This configuration is " << (network_policy ? "" : "not ")
(...skipping 14 matching lines...) Expand all
316 323
317 void ManagedNetworkConfigurationHandlerImpl::CreateConfiguration( 324 void ManagedNetworkConfigurationHandlerImpl::CreateConfiguration(
318 const std::string& userhash, 325 const std::string& userhash,
319 const base::DictionaryValue& properties, 326 const base::DictionaryValue& properties,
320 const network_handler::StringResultCallback& callback, 327 const network_handler::StringResultCallback& callback,
321 const network_handler::ErrorCallback& error_callback) const { 328 const network_handler::ErrorCallback& error_callback) const {
322 const Policies* policies = GetPoliciesForUser(userhash); 329 const Policies* policies = GetPoliciesForUser(userhash);
323 if (!policies) { 330 if (!policies) {
324 InvokeErrorCallback("", error_callback, kPoliciesNotInitialized); 331 InvokeErrorCallback("", error_callback, kPoliciesNotInitialized);
325 return; 332 return;
326 } 333 }
pneubeck (no reviews) 2014/11/27 14:56:45 when we adapt the policy matching, you will have t
cschuet (SLOW) 2014/11/27 15:44:30 Acknowledged.
327 334
328 if (policy_util::FindMatchingPolicy(policies->per_network_config, 335 if (policy_util::FindMatchingPolicy(policies->per_network_config,
329 properties)) { 336 properties)) {
330 InvokeErrorCallback("", error_callback, kNetworkAlreadyConfigured); 337 InvokeErrorCallback("", error_callback, kNetworkAlreadyConfigured);
331 return; 338 return;
332 } 339 }
333 340
334 const NetworkProfile* profile = 341 const NetworkProfile* profile =
335 network_profile_handler_->GetProfileForUserhash(userhash); 342 network_profile_handler_->GetProfileForUserhash(userhash);
336 if (!profile) { 343 if (!profile) {
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 scoped_ptr<base::DictionaryValue> network_properties, 795 scoped_ptr<base::DictionaryValue> network_properties,
789 GetDevicePropertiesCallback send_callback, 796 GetDevicePropertiesCallback send_callback,
790 const std::string& error_name, 797 const std::string& error_name,
791 scoped_ptr<base::DictionaryValue> error_data) { 798 scoped_ptr<base::DictionaryValue> error_data) {
792 NET_LOG_ERROR("Error getting device properties", service_path); 799 NET_LOG_ERROR("Error getting device properties", service_path);
793 send_callback.Run(service_path, network_properties.Pass()); 800 send_callback.Run(service_path, network_properties.Pass());
794 } 801 }
795 802
796 803
797 } // namespace chromeos 804 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698