diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-31 16:18:23 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-31 16:18:23 +0000 |
commit | aa2a6a99354d7b4d27cccd20585578ca22c77c70 (patch) | |
tree | 250250e6499b0fb6c29a1dbddff1b505cfc0b050 /chromeos | |
parent | 7d016b3d0ac7822215d74cb58f191d46b77f6e5c (diff) | |
download | chromium_src-aa2a6a99354d7b4d27cccd20585578ca22c77c70.zip chromium_src-aa2a6a99354d7b4d27cccd20585578ca22c77c70.tar.gz chromium_src-aa2a6a99354d7b4d27cccd20585578ca22c77c70.tar.bz2 |
Revert 203406 "Remove NetworkStateInformer's dependency on Proxy..."
By request of the author in case it broke CrOS ASAN, which it did:
http://build.chromium.org/p/chromium.memory/buildstatus?builder=Chromium%20OS%20%28amd64%29%20ASAN&number=4664
BUG=189009
TBR=pneubeck@chromium.org
Review URL: https://codereview.chromium.org/16004009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203415 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos')
-rw-r--r-- | chromeos/network/managed_state.h | 11 | ||||
-rw-r--r-- | chromeos/network/network_state.cc | 40 | ||||
-rw-r--r-- | chromeos/network/network_state.h | 11 |
3 files changed, 17 insertions, 45 deletions
diff --git a/chromeos/network/managed_state.h b/chromeos/network/managed_state.h index f128edc..8fc198d 100644 --- a/chromeos/network/managed_state.h +++ b/chromeos/network/managed_state.h @@ -40,14 +40,9 @@ class ManagedState { NetworkState* AsNetworkState(); DeviceState* AsDeviceState(); - // Called by NetworkStateHandler when a property was received. The return - // value indicates if the state changed and is used to reduce the number of - // notifications. The only guarantee however is: If the return value is false - // then the state wasn't modified. This might happen because of - // * |key| was not recognized. - // * |value| was not parsed successfully. - // * |value| is equal to the cached property value. - // If the return value is true, the state might or might not be modified. + // Called by NetworkStateHandler when a property changes. Returns false if + // the property was not recognized, was not parsed successfully, or is + // unchanged (complex properties may be assumed to have changed). virtual bool PropertyChanged(const std::string& key, const base::Value& value) = 0; diff --git a/chromeos/network/network_state.cc b/chromeos/network/network_state.cc index 1d916ee..57dfcd5 100644 --- a/chromeos/network/network_state.cc +++ b/chromeos/network/network_state.cc @@ -10,8 +10,8 @@ #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/onc/onc_utils.h" #include "third_party/cros_system_api/dbus/service_constants.h" namespace { @@ -88,9 +88,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_)) + return true; } else if (key == flimflam::kActivationStateProperty) { return GetStringValue(key, value, &activation_state_); } else if (key == flimflam::kRoamingStateProperty) { @@ -103,29 +103,6 @@ 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 (!value.GetAsString(&proxy_config_str)) { - LOG(WARNING) << "Failed to parse string value for:" << key; - 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) { - // Warning: The DictionaryValue return from - // ReadDictionaryFromJson/JSONParser is an optimized derived class that - // doesn't allow releasing ownership of nested values. A Swap in the wrong - // order leads to memory access errors. - proxy_config_.MergeDictionary(proxy_config_dict.get()); - } 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) { @@ -134,6 +111,8 @@ bool NetworkState::PropertyChanged(const std::string& key, return GetStringValue(key, value, &guid_); } else if (key == flimflam::kProfileProperty) { return GetStringValue(key, value, &profile_path_); + } else if (key == flimflam::kProxyConfigProperty) { + return GetStringValue(key, value, &proxy_config_); } else if (key == shill::kActivateOverNonCellularNetworkProperty) { return GetBooleanValue(key, value, &activate_over_non_cellular_networks_); } else if (key == shill::kOutOfCreditsProperty) { @@ -192,11 +171,6 @@ void NetworkState::GetProperties(base::DictionaryValue* dictionary) const { favorite_); dictionary->SetIntegerWithoutPathExpansion(flimflam::kPriorityProperty, priority_); - // Proxy config is intentionally omitted: This property is - // placed in NetworkState to transition proxy configuration 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_); @@ -205,6 +179,8 @@ void NetworkState::GetProperties(base::DictionaryValue* dictionary) const { dictionary->SetStringWithoutPathExpansion(flimflam::kGuidProperty, guid_); dictionary->SetStringWithoutPathExpansion(flimflam::kProfileProperty, profile_path_); + dictionary->SetStringWithoutPathExpansion(flimflam::kProxyConfigProperty, + proxy_config_); dictionary->SetBooleanWithoutPathExpansion( shill::kActivateOverNonCellularNetworkProperty, activate_over_non_cellular_networks_); diff --git a/chromeos/network/network_state.h b/chromeos/network/network_state.h index 4718820..c78d5e8 100644 --- a/chromeos/network/network_state.h +++ b/chromeos/network/network_state.h @@ -8,9 +8,12 @@ #include <string> #include <vector> -#include "base/values.h" #include "chromeos/network/managed_state.h" +namespace base { +class DictionaryValue; +} + namespace chromeos { // Simple class to provide network state information about a network service. @@ -42,12 +45,12 @@ class CHROMEOS_EXPORT NetworkState : public ManagedState { const std::string& guid() const { return guid_; } const std::string& connection_state() const { return connection_state_; } const std::string& profile_path() const { return profile_path_; } + const std::string& proxy_config() const { return proxy_config_; } const std::string& error() const { return error_; } const std::string& error_details() const { return error_details_; } bool auto_connect() const { return auto_connect_; } bool favorite() const { return favorite_; } int priority() const { return priority_; } - const base::DictionaryValue& proxy_config() const { return proxy_config_; } // Wireless property accessors int signal_strength() const { return signal_strength_; } bool connectable() const { return connectable_; } @@ -97,14 +100,12 @@ class CHROMEOS_EXPORT NetworkState : public ManagedState { std::string guid_; std::string connection_state_; std::string profile_path_; + std::string proxy_config_; std::string error_; std::string error_details_; bool auto_connect_; bool favorite_; int priority_; - // TODO(pneubeck): Remove this property once NetworkConfigurationHandler - // provides proxy configuration. crbug/241775 - base::DictionaryValue proxy_config_; // IPConfig properties. // Note: These do not correspond to actual Shill.Service properties // but are derived from the service's corresponding IPConfig object. |