| 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 <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 return; | 831 return; |
| 832 } | 832 } |
| 833 | 833 |
| 834 // Get the hardware MAC address from the DeviceState. | 834 // Get the hardware MAC address from the DeviceState. |
| 835 if (!device_state->mac_address().empty()) { | 835 if (!device_state->mac_address().empty()) { |
| 836 properties->SetStringWithoutPathExpansion( | 836 properties->SetStringWithoutPathExpansion( |
| 837 shill::kAddressProperty, device_state->mac_address()); | 837 shill::kAddressProperty, device_state->mac_address()); |
| 838 } | 838 } |
| 839 | 839 |
| 840 // Convert IPConfig dictionary to a ListValue. | 840 // Convert IPConfig dictionary to a ListValue. |
| 841 base::ListValue* ip_configs = new base::ListValue; | 841 auto ip_configs = base::MakeUnique<base::ListValue>(); |
| 842 for (base::DictionaryValue::Iterator iter(device_state->ip_configs()); | 842 for (base::DictionaryValue::Iterator iter(device_state->ip_configs()); |
| 843 !iter.IsAtEnd(); iter.Advance()) { | 843 !iter.IsAtEnd(); iter.Advance()) { |
| 844 ip_configs->Append(iter.value().CreateDeepCopy()); | 844 ip_configs->Append(iter.value().CreateDeepCopy()); |
| 845 } | 845 } |
| 846 properties->SetWithoutPathExpansion(shill::kIPConfigsProperty, ip_configs); | 846 properties->SetWithoutPathExpansion(shill::kIPConfigsProperty, |
| 847 std::move(ip_configs)); |
| 847 } | 848 } |
| 848 | 849 |
| 849 void ManagedNetworkConfigurationHandlerImpl::GetPropertiesCallback( | 850 void ManagedNetworkConfigurationHandlerImpl::GetPropertiesCallback( |
| 850 GetDevicePropertiesCallback send_callback, | 851 GetDevicePropertiesCallback send_callback, |
| 851 const std::string& service_path, | 852 const std::string& service_path, |
| 852 const base::DictionaryValue& shill_properties) { | 853 const base::DictionaryValue& shill_properties) { |
| 853 std::unique_ptr<base::DictionaryValue> shill_properties_copy( | 854 std::unique_ptr<base::DictionaryValue> shill_properties_copy( |
| 854 shill_properties.DeepCopy()); | 855 shill_properties.DeepCopy()); |
| 855 | 856 |
| 856 std::string guid; | 857 std::string guid; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 } | 910 } |
| 910 | 911 |
| 911 void ManagedNetworkConfigurationHandlerImpl::GetDevicePropertiesSuccess( | 912 void ManagedNetworkConfigurationHandlerImpl::GetDevicePropertiesSuccess( |
| 912 const std::string& service_path, | 913 const std::string& service_path, |
| 913 std::unique_ptr<base::DictionaryValue> network_properties, | 914 std::unique_ptr<base::DictionaryValue> network_properties, |
| 914 GetDevicePropertiesCallback send_callback, | 915 GetDevicePropertiesCallback send_callback, |
| 915 const std::string& device_path, | 916 const std::string& device_path, |
| 916 const base::DictionaryValue& device_properties) { | 917 const base::DictionaryValue& device_properties) { |
| 917 // Create a "Device" dictionary in |network_properties|. | 918 // Create a "Device" dictionary in |network_properties|. |
| 918 network_properties->SetWithoutPathExpansion( | 919 network_properties->SetWithoutPathExpansion( |
| 919 shill::kDeviceProperty, device_properties.DeepCopy()); | 920 shill::kDeviceProperty, base::MakeUnique<base::Value>(device_properties)); |
| 920 send_callback.Run(service_path, std::move(network_properties)); | 921 send_callback.Run(service_path, std::move(network_properties)); |
| 921 } | 922 } |
| 922 | 923 |
| 923 void ManagedNetworkConfigurationHandlerImpl::GetDevicePropertiesFailure( | 924 void ManagedNetworkConfigurationHandlerImpl::GetDevicePropertiesFailure( |
| 924 const std::string& service_path, | 925 const std::string& service_path, |
| 925 std::unique_ptr<base::DictionaryValue> network_properties, | 926 std::unique_ptr<base::DictionaryValue> network_properties, |
| 926 GetDevicePropertiesCallback send_callback, | 927 GetDevicePropertiesCallback send_callback, |
| 927 const std::string& error_name, | 928 const std::string& error_name, |
| 928 std::unique_ptr<base::DictionaryValue> error_data) { | 929 std::unique_ptr<base::DictionaryValue> error_data) { |
| 929 NET_LOG_ERROR("Error getting device properties", service_path); | 930 NET_LOG_ERROR("Error getting device properties", service_path); |
| 930 send_callback.Run(service_path, std::move(network_properties)); | 931 send_callback.Run(service_path, std::move(network_properties)); |
| 931 } | 932 } |
| 932 | 933 |
| 933 | 934 |
| 934 } // namespace chromeos | 935 } // namespace chromeos |
| OLD | NEW |