Index: chromeos/network/network_state.cc |
diff --git a/chromeos/network/network_state.cc b/chromeos/network/network_state.cc |
index 761a9859e78cf197b45d2152435f0486b2a22dc2..ed86276cf15c031f4410b00a1f7e5170a0fa7052 100644 |
--- a/chromeos/network/network_state.cc |
+++ b/chromeos/network/network_state.cc |
@@ -7,6 +7,21 @@ |
#include "base/values.h" |
#include "third_party/cros_system_api/dbus/service_constants.h" |
+namespace { |
+ |
+bool ConvertListValueToStringVector(const base::ListValue& string_list, |
+ std::vector<std::string>* result) { |
+ for (size_t i = 0; i < string_list.GetSize(); ++i) { |
+ std::string str; |
+ if (!string_list.GetString(i, &str)) |
+ return false; |
+ result->push_back(str); |
+ } |
+ return true; |
+} |
+ |
+} // namespace |
+ |
namespace chromeos { |
NetworkState::NetworkState(const std::string& path) |
@@ -28,6 +43,14 @@ bool NetworkState::PropertyChanged(const std::string& key, |
return GetStringValue(key, value, &connection_state_); |
} else if (key == flimflam::kErrorProperty) { |
return GetStringValue(key, value, &error_); |
+ } else if (key == flimflam::kAddressProperty) { |
+ return GetStringValue(key, value, &ip_address_); |
+ } else if (key == flimflam::kNameServersProperty) { |
+ dns_servers_.clear(); |
+ const base::ListValue* dns_servers; |
+ if (value.GetAsList(&dns_servers) && |
+ ConvertListValueToStringVector(*dns_servers, &dns_servers_)) |
+ return true; |
} else if (key == flimflam::kActivationStateProperty) { |
return GetStringValue(key, value, &activation_state_); |
} else if (key == flimflam::kRoamingStateProperty) { |
@@ -58,6 +81,13 @@ void NetworkState::GetProperties(base::DictionaryValue* dictionary) const { |
connection_state()); |
dictionary->SetStringWithoutPathExpansion(flimflam::kErrorProperty, |
error()); |
+ dictionary->SetStringWithoutPathExpansion(flimflam::kAddressProperty, |
+ ip_address()); |
+ base::ListValue* value = new ListValue; |
+ for (size_t i = 0; i < dns_servers().size(); ++i) |
+ value->Append(new base::StringValue(dns_servers()[i])); |
stevenjb
2013/03/29 00:21:36
value->AppendStrings(dns_servers());
gauravsh
2013/03/29 00:41:50
Thanks. Done.
|
+ dictionary->SetWithoutPathExpansion(flimflam::kNameServersProperty, |
+ value); |
dictionary->SetStringWithoutPathExpansion(flimflam::kActivationStateProperty, |
activation_state()); |
dictionary->SetStringWithoutPathExpansion(flimflam::kRoamingStateProperty, |