Index: chromeos/network/network_state.cc |
diff --git a/chromeos/network/network_state.cc b/chromeos/network/network_state.cc |
index 3aa0472174b3f2ed729e632706b11bd27498982d..8c48b1127f75e49dabd4143bfc8a2e113c928ed3 100644 |
--- a/chromeos/network/network_state.cc |
+++ b/chromeos/network/network_state.cc |
@@ -6,12 +6,14 @@ |
#include "base/i18n/icu_encoding_detection.h" |
#include "base/i18n/icu_string_conversions.h" |
+#include "base/json/json_reader.h" |
#include "base/string_util.h" |
#include "base/stringprintf.h" |
#include "base/strings/string_number_conversions.h" |
#include "base/strings/utf_string_conversion_utils.h" |
-#include "base/values.h" |
#include "chromeos/network/network_event_log.h" |
+#include "chromeos/network/network_ui_data.h" |
+#include "chromeos/network/onc/onc_utils.h" |
#include "third_party/cros_system_api/dbus/service_constants.h" |
namespace { |
@@ -58,6 +60,7 @@ NetworkState::NetworkState(const std::string& path) |
auto_connect_(false), |
favorite_(false), |
priority_(0), |
+ onc_source_(onc::ONC_SOURCE_NONE), |
signal_strength_(0), |
activate_over_non_cellular_networks_(false), |
cellular_out_of_credits_(false) { |
@@ -82,9 +85,9 @@ bool NetworkState::PropertyChanged(const std::string& key, |
} else if (key == IPConfigProperty(flimflam::kNameServersProperty)) { |
dns_servers_.clear(); |
const base::ListValue* dns_servers; |
- if (value.GetAsList(&dns_servers) && |
- ConvertListValueToStringVector(*dns_servers, &dns_servers_)) |
- return true; |
+ if (value.GetAsList(&dns_servers)) |
+ ConvertListValueToStringVector(*dns_servers, &dns_servers_); |
Mattias Nissler (ping if slow)
2013/05/08 12:46:36
Hm, this returns true now also for broken dns_serv
pneubeck (no reviews)
2013/05/08 18:32:14
The description for this function in the header ch
|
+ return true; |
} else if (key == flimflam::kActivationStateProperty) { |
return GetStringValue(key, value, &activation_state_); |
} else if (key == flimflam::kRoamingStateProperty) { |
@@ -97,6 +100,38 @@ bool NetworkState::PropertyChanged(const std::string& key, |
return GetBooleanValue(key, value, &favorite_); |
} else if (key == flimflam::kPriorityProperty) { |
return GetIntegerValue(key, value, &priority_); |
+ } else if (key == flimflam::kProxyConfigProperty) { |
+ std::string proxy_config_str; |
+ if (!GetStringValue(key, value, &proxy_config_str)) |
+ return false; |
+ |
+ proxy_config_.Clear(); |
+ if (proxy_config_str.empty()) |
+ return true; |
+ |
+ scoped_ptr<base::DictionaryValue> proxy_config_dict( |
+ onc::ReadDictionaryFromJson(proxy_config_str)); |
+ if (proxy_config_dict) |
+ proxy_config_.MergeDictionary(proxy_config_dict.get()); |
+ else |
+ LOG(WARNING) << "Failed to parse dictionary value for: " << key; |
+ return true; |
+ } else if (key == flimflam::kUIDataProperty) { |
+ std::string ui_data_str; |
+ if (!GetStringValue(key, value, &ui_data_str)) |
+ return false; |
+ |
+ onc_source_ = onc::ONC_SOURCE_NONE; |
+ if (ui_data_str.empty()) |
+ return true; |
+ |
+ scoped_ptr<base::DictionaryValue> ui_data_dict( |
+ onc::ReadDictionaryFromJson(ui_data_str)); |
+ if (ui_data_dict) |
+ onc_source_ = NetworkUIData(*ui_data_dict).onc_source(); |
+ else |
+ LOG(WARNING) << "Failed to parse dictionary value for: " << key; |
+ return true; |
} else if (key == flimflam::kNetworkTechnologyProperty) { |
return GetStringValue(key, value, &technology_); |
} else if (key == flimflam::kDeviceProperty) { |
@@ -157,6 +192,11 @@ void NetworkState::GetProperties(base::DictionaryValue* dictionary) const { |
favorite()); |
dictionary->SetIntegerWithoutPathExpansion(flimflam::kPriorityProperty, |
priority()); |
+ // Proxy config and ONC source is intentionally omitted: These properties are |
+ // placed in NetworkState to transition ProxyConfigServiceImpl from |
+ // NetworkLibrary to the new network stack. The networking extension API |
+ // shouldn't depend on this member. Once ManagedNetworkConfigurationHandler |
+ // is used instead of NetworkLibrary, we can remove them again. |
dictionary->SetStringWithoutPathExpansion( |
flimflam::kNetworkTechnologyProperty, |
technology()); |