Chromium Code Reviews| Index: chromeos/network/network_state.cc |
| diff --git a/chromeos/network/network_state.cc b/chromeos/network/network_state.cc |
| index 0fb6bf489730c8d1728e23de09df9da6b553f92c..ec4454560a8e511daffe0f59b1174e4552ad4dd7 100644 |
| --- a/chromeos/network/network_state.cc |
| +++ b/chromeos/network/network_state.cc |
| @@ -90,37 +90,6 @@ bool NetworkState::PropertyChanged(const std::string& key, |
| else |
| error_.clear(); |
| return true; |
| - } else if (key == IPConfigProperty(shill::kAddressProperty)) { |
| - return GetStringValue(key, value, &ip_address_); |
| - } else if (key == IPConfigProperty(shill::kGatewayProperty)) { |
| - return GetStringValue(key, value, &gateway_); |
| - } else if (key == IPConfigProperty(shill::kNameServersProperty)) { |
| - const base::ListValue* dns_servers; |
| - if (!value.GetAsList(&dns_servers)) |
| - return false; |
| - dns_servers_.clear(); |
| - ConvertListValueToStringVector(*dns_servers, &dns_servers_); |
| - return true; |
| - } else if (key == IPConfigProperty(shill::kPrefixlenProperty)) { |
| - return GetIntegerValue(key, value, &prefix_length_); |
| - } else if (key == IPConfigProperty( |
| - shill::kWebProxyAutoDiscoveryUrlProperty)) { |
| - std::string url_string; |
| - if (!GetStringValue(key, value, &url_string)) |
| - return false; |
| - if (url_string.empty()) { |
| - web_proxy_auto_discovery_url_ = GURL(); |
| - } else { |
| - GURL gurl(url_string); |
| - if (!gurl.is_valid()) { |
| - web_proxy_auto_discovery_url_ = gurl; |
| - } else { |
| - NET_LOG_ERROR("Invalid WebProxyAutoDiscoveryUrl: " + url_string, |
| - path()); |
| - web_proxy_auto_discovery_url_ = GURL(); |
| - } |
| - } |
| - return true; |
| } else if (key == shill::kActivationStateProperty) { |
| return GetStringValue(key, value, &activation_state_); |
| } else if (key == shill::kRoamingStateProperty) { |
| @@ -210,6 +179,45 @@ void NetworkState::GetStateProperties(base::DictionaryValue* dictionary) const { |
| } |
| } |
| +void NetworkState::IPConfigPropertiesChanged( |
| + const base::DictionaryValue& properties) { |
| + for (base::DictionaryValue::Iterator iter(properties); |
| + !iter.IsAtEnd(); iter.Advance()) { |
| + std::string key = iter.key(); |
| + const base::Value& value = iter.value(); |
| + |
| + if (key == shill::kAddressProperty) { |
| + GetStringValue(key, value, &ip_address_); |
| + } else if (key == shill::kGatewayProperty) { |
| + GetStringValue(key, value, &gateway_); |
| + } else if (key == shill::kNameServersProperty) { |
| + const base::ListValue* dns_servers; |
|
pneubeck (no reviews)
2014/05/05 21:09:28
nit: initialize with NULL
stevenjb
2014/05/06 01:15:11
Not necessary here, Value is guaranteed to set dns
|
| + if (value.GetAsList(&dns_servers)) { |
| + dns_servers_.clear(); |
| + ConvertListValueToStringVector(*dns_servers, &dns_servers_); |
| + } |
| + } else if (key == shill::kPrefixlenProperty) { |
| + GetIntegerValue(key, value, &prefix_length_); |
| + } else if (key == shill::kWebProxyAutoDiscoveryUrlProperty) { |
| + std::string url_string; |
| + if (GetStringValue(key, value, &url_string)) { |
| + if (url_string.empty()) { |
| + web_proxy_auto_discovery_url_ = GURL(); |
| + } else { |
| + GURL gurl(url_string); |
| + if (!gurl.is_valid()) { |
|
pneubeck (no reviews)
2014/05/05 21:09:28
wrong negation?
stevenjb
2014/05/06 01:15:11
Huh. Wonder why this hasn't caused us problems? (I
|
| + web_proxy_auto_discovery_url_ = gurl; |
| + } else { |
| + NET_LOG_ERROR("Invalid WebProxyAutoDiscoveryUrl: " + url_string, |
| + path()); |
| + web_proxy_auto_discovery_url_ = GURL(); |
| + } |
| + } |
| + } |
| + } |
| + } |
| +} |
| + |
| bool NetworkState::RequiresActivation() const { |
| return (type() == shill::kTypeCellular && |
| activation_state() != shill::kActivationStateActivated && |
| @@ -273,9 +281,4 @@ bool NetworkState::ErrorIsValid(const std::string& error) { |
| return !error.empty() && error != kErrorUnknown; |
| } |
| -// static |
| -std::string NetworkState::IPConfigProperty(const char* key) { |
| - return base::StringPrintf("%s.%s", shill::kIPConfigProperty, key); |
| -} |
| - |
| } // namespace chromeos |