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 <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 properties->SetWithoutPathExpansion(shill::kIPConfigsProperty, ip_configs); | 732 properties->SetWithoutPathExpansion(shill::kIPConfigsProperty, ip_configs); |
733 } | 733 } |
734 | 734 |
735 void ManagedNetworkConfigurationHandlerImpl::GetPropertiesCallback( | 735 void ManagedNetworkConfigurationHandlerImpl::GetPropertiesCallback( |
736 GetDevicePropertiesCallback send_callback, | 736 GetDevicePropertiesCallback send_callback, |
737 const std::string& service_path, | 737 const std::string& service_path, |
738 const base::DictionaryValue& shill_properties) { | 738 const base::DictionaryValue& shill_properties) { |
739 scoped_ptr<base::DictionaryValue> shill_properties_copy( | 739 scoped_ptr<base::DictionaryValue> shill_properties_copy( |
740 shill_properties.DeepCopy()); | 740 shill_properties.DeepCopy()); |
741 | 741 |
| 742 std::string guid; |
| 743 shill_properties.GetStringWithoutPathExpansion(shill::kGuidProperty, &guid); |
| 744 if (guid.empty()) { |
| 745 // Unmanaged networks are assigned a GUID in NetworkState. Provide this |
| 746 // value in the ONC dictionary. |
| 747 const NetworkState* state = |
| 748 network_state_handler_->GetNetworkState(service_path); |
| 749 if (state && !state->guid().empty()) { |
| 750 guid = state->guid(); |
| 751 shill_properties_copy->SetStringWithoutPathExpansion(shill::kGuidProperty, |
| 752 guid); |
| 753 } else { |
| 754 LOG(ERROR) << "Network has no GUID specified: " << service_path; |
| 755 } |
| 756 } |
| 757 |
742 std::string type; | 758 std::string type; |
743 shill_properties_copy->GetStringWithoutPathExpansion(shill::kTypeProperty, | 759 shill_properties_copy->GetStringWithoutPathExpansion(shill::kTypeProperty, |
744 &type); | 760 &type); |
745 // Add associated DeviceState properties for non-VPN networks. | 761 // Add associated DeviceState properties for non-VPN networks. |
746 if (type != shill::kTypeVPN) | 762 if (type != shill::kTypeVPN) |
747 GetDeviceStateProperties(service_path, shill_properties_copy.get()); | 763 GetDeviceStateProperties(service_path, shill_properties_copy.get()); |
748 | 764 |
749 // Only request additional Device properties for Cellular networks with a | 765 // Only request additional Device properties for Cellular networks with a |
750 // valid device. | 766 // valid device. |
751 std::string device_path; | 767 std::string device_path; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 scoped_ptr<base::DictionaryValue> network_properties, | 811 scoped_ptr<base::DictionaryValue> network_properties, |
796 GetDevicePropertiesCallback send_callback, | 812 GetDevicePropertiesCallback send_callback, |
797 const std::string& error_name, | 813 const std::string& error_name, |
798 scoped_ptr<base::DictionaryValue> error_data) { | 814 scoped_ptr<base::DictionaryValue> error_data) { |
799 NET_LOG_ERROR("Error getting device properties", service_path); | 815 NET_LOG_ERROR("Error getting device properties", service_path); |
800 send_callback.Run(service_path, network_properties.Pass()); | 816 send_callback.Run(service_path, network_properties.Pass()); |
801 } | 817 } |
802 | 818 |
803 | 819 |
804 } // namespace chromeos | 820 } // namespace chromeos |
OLD | NEW |