OLD | NEW |
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 <utility> |
7 #include <vector> | 8 #include <vector> |
8 | 9 |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/guid.h" | 11 #include "base/guid.h" |
11 #include "base/location.h" | 12 #include "base/location.h" |
12 #include "base/logging.h" | 13 #include "base/logging.h" |
13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
14 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
15 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
16 #include "base/values.h" | 17 #include "base/values.h" |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 state->device_path(), carrier, | 333 state->device_path(), carrier, |
333 base::Bind( | 334 base::Bind( |
334 &ManagedNetworkConfigurationHandlerImpl::SetShillProperties, | 335 &ManagedNetworkConfigurationHandlerImpl::SetShillProperties, |
335 weak_ptr_factory_.GetWeakPtr(), service_path, | 336 weak_ptr_factory_.GetWeakPtr(), service_path, |
336 base::Passed(&shill_dictionary), callback, error_callback), | 337 base::Passed(&shill_dictionary), callback, error_callback), |
337 error_callback); | 338 error_callback); |
338 return; | 339 return; |
339 } | 340 } |
340 } | 341 } |
341 | 342 |
342 SetShillProperties(service_path, shill_dictionary.Pass(), callback, | 343 SetShillProperties(service_path, std::move(shill_dictionary), callback, |
343 error_callback); | 344 error_callback); |
344 } | 345 } |
345 | 346 |
346 void ManagedNetworkConfigurationHandlerImpl::SetShillProperties( | 347 void ManagedNetworkConfigurationHandlerImpl::SetShillProperties( |
347 const std::string& service_path, | 348 const std::string& service_path, |
348 scoped_ptr<base::DictionaryValue> shill_dictionary, | 349 scoped_ptr<base::DictionaryValue> shill_dictionary, |
349 const base::Closure& callback, | 350 const base::Closure& callback, |
350 const network_handler::ErrorCallback& error_callback) { | 351 const network_handler::ErrorCallback& error_callback) { |
351 network_configuration_handler_->SetShillProperties( | 352 network_configuration_handler_->SetShillProperties( |
352 service_path, *shill_dictionary, | 353 service_path, *shill_dictionary, |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 GetDeviceStateProperties(service_path, shill_properties_copy.get()); | 812 GetDeviceStateProperties(service_path, shill_properties_copy.get()); |
812 | 813 |
813 // Only request additional Device properties for Cellular networks with a | 814 // Only request additional Device properties for Cellular networks with a |
814 // valid device. | 815 // valid device. |
815 std::string device_path; | 816 std::string device_path; |
816 if (!network_device_handler_ || | 817 if (!network_device_handler_ || |
817 type != shill::kTypeCellular || | 818 type != shill::kTypeCellular || |
818 !shill_properties_copy->GetStringWithoutPathExpansion( | 819 !shill_properties_copy->GetStringWithoutPathExpansion( |
819 shill::kDeviceProperty, &device_path) || | 820 shill::kDeviceProperty, &device_path) || |
820 device_path.empty()) { | 821 device_path.empty()) { |
821 send_callback.Run(service_path, shill_properties_copy.Pass()); | 822 send_callback.Run(service_path, std::move(shill_properties_copy)); |
822 return; | 823 return; |
823 } | 824 } |
824 | 825 |
825 // Request the device properties. On success or failure pass (a possibly | 826 // Request the device properties. On success or failure pass (a possibly |
826 // modified) |shill_properties| to |send_callback|. | 827 // modified) |shill_properties| to |send_callback|. |
827 scoped_ptr<base::DictionaryValue> shill_properties_copy_error_copy( | 828 scoped_ptr<base::DictionaryValue> shill_properties_copy_error_copy( |
828 shill_properties_copy->DeepCopy()); | 829 shill_properties_copy->DeepCopy()); |
829 network_device_handler_->GetDeviceProperties( | 830 network_device_handler_->GetDeviceProperties( |
830 device_path, | 831 device_path, |
831 base::Bind(&ManagedNetworkConfigurationHandlerImpl:: | 832 base::Bind(&ManagedNetworkConfigurationHandlerImpl:: |
(...skipping 12 matching lines...) Expand all Loading... |
844 | 845 |
845 void ManagedNetworkConfigurationHandlerImpl::GetDevicePropertiesSuccess( | 846 void ManagedNetworkConfigurationHandlerImpl::GetDevicePropertiesSuccess( |
846 const std::string& service_path, | 847 const std::string& service_path, |
847 scoped_ptr<base::DictionaryValue> network_properties, | 848 scoped_ptr<base::DictionaryValue> network_properties, |
848 GetDevicePropertiesCallback send_callback, | 849 GetDevicePropertiesCallback send_callback, |
849 const std::string& device_path, | 850 const std::string& device_path, |
850 const base::DictionaryValue& device_properties) { | 851 const base::DictionaryValue& device_properties) { |
851 // Create a "Device" dictionary in |network_properties|. | 852 // Create a "Device" dictionary in |network_properties|. |
852 network_properties->SetWithoutPathExpansion( | 853 network_properties->SetWithoutPathExpansion( |
853 shill::kDeviceProperty, device_properties.DeepCopy()); | 854 shill::kDeviceProperty, device_properties.DeepCopy()); |
854 send_callback.Run(service_path, network_properties.Pass()); | 855 send_callback.Run(service_path, std::move(network_properties)); |
855 } | 856 } |
856 | 857 |
857 void ManagedNetworkConfigurationHandlerImpl::GetDevicePropertiesFailure( | 858 void ManagedNetworkConfigurationHandlerImpl::GetDevicePropertiesFailure( |
858 const std::string& service_path, | 859 const std::string& service_path, |
859 scoped_ptr<base::DictionaryValue> network_properties, | 860 scoped_ptr<base::DictionaryValue> network_properties, |
860 GetDevicePropertiesCallback send_callback, | 861 GetDevicePropertiesCallback send_callback, |
861 const std::string& error_name, | 862 const std::string& error_name, |
862 scoped_ptr<base::DictionaryValue> error_data) { | 863 scoped_ptr<base::DictionaryValue> error_data) { |
863 NET_LOG_ERROR("Error getting device properties", service_path); | 864 NET_LOG_ERROR("Error getting device properties", service_path); |
864 send_callback.Run(service_path, network_properties.Pass()); | 865 send_callback.Run(service_path, std::move(network_properties)); |
865 } | 866 } |
866 | 867 |
867 | 868 |
868 } // namespace chromeos | 869 } // namespace chromeos |
OLD | NEW |