| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/network_state.h" | 5 #include "chromeos/network/network_state.h" |
| 6 | 6 |
| 7 #include "base/i18n/icu_encoding_detection.h" | 7 #include "base/i18n/icu_encoding_detection.h" |
| 8 #include "base/i18n/icu_string_conversions.h" | 8 #include "base/i18n/icu_string_conversions.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 return GetStringValue(key, value, &connection_state_); | 110 return GetStringValue(key, value, &connection_state_); |
| 111 } else if (key == flimflam::kConnectableProperty) { | 111 } else if (key == flimflam::kConnectableProperty) { |
| 112 return GetBooleanValue(key, value, &connectable_); | 112 return GetBooleanValue(key, value, &connectable_); |
| 113 } else if (key == flimflam::kErrorProperty) { | 113 } else if (key == flimflam::kErrorProperty) { |
| 114 if (!GetStringValue(key, value, &error_)) | 114 if (!GetStringValue(key, value, &error_)) |
| 115 return false; | 115 return false; |
| 116 // Shill uses "Unknown" to indicate an unset error state. | 116 // Shill uses "Unknown" to indicate an unset error state. |
| 117 if (error_ == kErrorUnknown) | 117 if (error_ == kErrorUnknown) |
| 118 error_.clear(); | 118 error_.clear(); |
| 119 return true; | 119 return true; |
| 120 } else if (key == shill::kErrorDetailsProperty) { | |
| 121 return GetStringValue(key, value, &error_details_); | |
| 122 } else if (key == IPConfigProperty(flimflam::kAddressProperty)) { | 120 } else if (key == IPConfigProperty(flimflam::kAddressProperty)) { |
| 123 return GetStringValue(key, value, &ip_address_); | 121 return GetStringValue(key, value, &ip_address_); |
| 124 } else if (key == IPConfigProperty(flimflam::kGatewayProperty)) { | 122 } else if (key == IPConfigProperty(flimflam::kGatewayProperty)) { |
| 125 return GetStringValue(key, value, &gateway_); | 123 return GetStringValue(key, value, &gateway_); |
| 126 } else if (key == IPConfigProperty(flimflam::kNameServersProperty)) { | 124 } else if (key == IPConfigProperty(flimflam::kNameServersProperty)) { |
| 127 const base::ListValue* dns_servers; | 125 const base::ListValue* dns_servers; |
| 128 if (!value.GetAsList(&dns_servers)) | 126 if (!value.GetAsList(&dns_servers)) |
| 129 return false; | 127 return false; |
| 130 dns_servers_.clear(); | 128 dns_servers_.clear(); |
| 131 ConvertListValueToStringVector(*dns_servers, &dns_servers_); | 129 ConvertListValueToStringVector(*dns_servers, &dns_servers_); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 dictionary->SetStringWithoutPathExpansion(flimflam::kTypeProperty, type()); | 236 dictionary->SetStringWithoutPathExpansion(flimflam::kTypeProperty, type()); |
| 239 dictionary->SetIntegerWithoutPathExpansion(flimflam::kSignalStrengthProperty, | 237 dictionary->SetIntegerWithoutPathExpansion(flimflam::kSignalStrengthProperty, |
| 240 signal_strength_); | 238 signal_strength_); |
| 241 dictionary->SetStringWithoutPathExpansion(flimflam::kStateProperty, | 239 dictionary->SetStringWithoutPathExpansion(flimflam::kStateProperty, |
| 242 connection_state_); | 240 connection_state_); |
| 243 dictionary->SetBooleanWithoutPathExpansion(flimflam::kConnectableProperty, | 241 dictionary->SetBooleanWithoutPathExpansion(flimflam::kConnectableProperty, |
| 244 connectable_); | 242 connectable_); |
| 245 | 243 |
| 246 dictionary->SetStringWithoutPathExpansion(flimflam::kErrorProperty, | 244 dictionary->SetStringWithoutPathExpansion(flimflam::kErrorProperty, |
| 247 error_); | 245 error_); |
| 248 dictionary->SetStringWithoutPathExpansion(shill::kErrorDetailsProperty, | |
| 249 error_details_); | |
| 250 | 246 |
| 251 // IPConfig properties | 247 // IPConfig properties |
| 252 base::DictionaryValue* ipconfig_properties = new base::DictionaryValue; | 248 base::DictionaryValue* ipconfig_properties = new base::DictionaryValue; |
| 253 ipconfig_properties->SetStringWithoutPathExpansion(flimflam::kAddressProperty, | 249 ipconfig_properties->SetStringWithoutPathExpansion(flimflam::kAddressProperty, |
| 254 ip_address_); | 250 ip_address_); |
| 255 ipconfig_properties->SetStringWithoutPathExpansion(flimflam::kGatewayProperty, | 251 ipconfig_properties->SetStringWithoutPathExpansion(flimflam::kGatewayProperty, |
| 256 gateway_); | 252 gateway_); |
| 257 base::ListValue* name_servers = new base::ListValue; | 253 base::ListValue* name_servers = new base::ListValue; |
| 258 name_servers->AppendStrings(dns_servers_); | 254 name_servers->AppendStrings(dns_servers_); |
| 259 ipconfig_properties->SetWithoutPathExpansion(flimflam::kNameServersProperty, | 255 ipconfig_properties->SetWithoutPathExpansion(flimflam::kNameServersProperty, |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 } | 452 } |
| 457 scoped_ptr<base::DictionaryValue> ui_data_dict( | 453 scoped_ptr<base::DictionaryValue> ui_data_dict( |
| 458 chromeos::onc::ReadDictionaryFromJson(ui_data_str)); | 454 chromeos::onc::ReadDictionaryFromJson(ui_data_str)); |
| 459 if (!ui_data_dict) | 455 if (!ui_data_dict) |
| 460 return false; | 456 return false; |
| 461 *out = NetworkUIData(*ui_data_dict); | 457 *out = NetworkUIData(*ui_data_dict); |
| 462 return true; | 458 return true; |
| 463 } | 459 } |
| 464 | 460 |
| 465 } // namespace chromeos | 461 } // namespace chromeos |
| OLD | NEW |