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

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

Issue 1028243007: Call Device.SetCarrier when the ONC Carrier property is specified. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@onc_clang
Patch Set: Fix components_unittests Created 5 years, 8 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 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 <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/guid.h" 10 #include "base/guid.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 &onc::kNetworkWithStateSignature)); 219 &onc::kNetworkWithStateSignature));
220 callback.Run(service_path, *onc_network); 220 callback.Run(service_path, *onc_network);
221 } 221 }
222 222
223 // SetProperties 223 // SetProperties
224 224
225 void ManagedNetworkConfigurationHandlerImpl::SetProperties( 225 void ManagedNetworkConfigurationHandlerImpl::SetProperties(
226 const std::string& service_path, 226 const std::string& service_path,
227 const base::DictionaryValue& user_settings, 227 const base::DictionaryValue& user_settings,
228 const base::Closure& callback, 228 const base::Closure& callback,
229 const network_handler::ErrorCallback& error_callback) const { 229 const network_handler::ErrorCallback& error_callback) {
230 const NetworkState* state = 230 const NetworkState* state =
231 network_state_handler_->GetNetworkStateFromServicePath( 231 network_state_handler_->GetNetworkStateFromServicePath(
232 service_path, true /* configured_only */); 232 service_path, true /* configured_only */);
233 if (!state) { 233 if (!state) {
234 InvokeErrorCallback(service_path, error_callback, kUnknownNetwork); 234 InvokeErrorCallback(service_path, error_callback, kUnknownNetwork);
235 return; 235 return;
236 } 236 }
237 237
238 std::string guid = state->guid(); 238 std::string guid = state->guid();
239 DCHECK(!guid.empty()); 239 DCHECK(!guid.empty());
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 VLOG(2) << "This configuration is " << (network_policy ? "" : "not ") 298 VLOG(2) << "This configuration is " << (network_policy ? "" : "not ")
299 << "managed."; 299 << "managed.";
300 300
301 scoped_ptr<base::DictionaryValue> shill_dictionary( 301 scoped_ptr<base::DictionaryValue> shill_dictionary(
302 policy_util::CreateShillConfiguration(*profile, 302 policy_util::CreateShillConfiguration(*profile,
303 guid, 303 guid,
304 &policies->global_network_config, 304 &policies->global_network_config,
305 network_policy, 305 network_policy,
306 validated_user_settings.get())); 306 validated_user_settings.get()));
307 307
308 // 'Carrier' needs to be handled specially if set.
309 base::DictionaryValue* cellular = nullptr;
310 if (validated_user_settings->GetDictionaryWithoutPathExpansion(
311 ::onc::network_config::kCellular, &cellular)) {
312 std::string carrier;
313 if (cellular->GetStringWithoutPathExpansion(::onc::cellular::kCarrier,
314 &carrier)) {
315 network_device_handler_->SetCarrier(
316 state->device_path(), carrier,
317 base::Bind(
318 &ManagedNetworkConfigurationHandlerImpl::SetShillProperties,
319 weak_ptr_factory_.GetWeakPtr(), service_path,
320 base::Passed(&shill_dictionary), callback, error_callback),
321 error_callback);
322 return;
323 }
324 }
325
326 SetShillProperties(service_path, shill_dictionary.Pass(), callback,
327 error_callback);
328 }
329
330 void ManagedNetworkConfigurationHandlerImpl::SetShillProperties(
331 const std::string& service_path,
332 scoped_ptr<base::DictionaryValue> shill_dictionary,
333 const base::Closure& callback,
334 const network_handler::ErrorCallback& error_callback) {
308 network_configuration_handler_->SetShillProperties( 335 network_configuration_handler_->SetShillProperties(
309 service_path, *shill_dictionary, 336 service_path, *shill_dictionary,
310 NetworkConfigurationObserver::SOURCE_USER_ACTION, callback, 337 NetworkConfigurationObserver::SOURCE_USER_ACTION, callback,
311 error_callback); 338 error_callback);
312 } 339 }
313 340
314 void ManagedNetworkConfigurationHandlerImpl::CreateConfiguration( 341 void ManagedNetworkConfigurationHandlerImpl::CreateConfiguration(
315 const std::string& userhash, 342 const std::string& userhash,
316 const base::DictionaryValue& properties, 343 const base::DictionaryValue& properties,
317 const network_handler::StringResultCallback& callback, 344 const network_handler::StringResultCallback& callback,
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 scoped_ptr<base::DictionaryValue> network_properties, 828 scoped_ptr<base::DictionaryValue> network_properties,
802 GetDevicePropertiesCallback send_callback, 829 GetDevicePropertiesCallback send_callback,
803 const std::string& error_name, 830 const std::string& error_name,
804 scoped_ptr<base::DictionaryValue> error_data) { 831 scoped_ptr<base::DictionaryValue> error_data) {
805 NET_LOG_ERROR("Error getting device properties", service_path); 832 NET_LOG_ERROR("Error getting device properties", service_path);
806 send_callback.Run(service_path, network_properties.Pass()); 833 send_callback.Run(service_path, network_properties.Pass());
807 } 834 }
808 835
809 836
810 } // namespace chromeos 837 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698