summaryrefslogtreecommitdiffstats
path: root/chromeos/network
diff options
context:
space:
mode:
authornkostylev@chromium.org <nkostylev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-23 09:03:34 +0000
committernkostylev@chromium.org <nkostylev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-23 09:03:34 +0000
commit434af790c954aad57021a821a1e91daf5ae287fe (patch)
tree22137710396949cd7ecf9a7a6fe65a84432ae5d2 /chromeos/network
parent3d830441c023a8c0a0aa0f104f018fc52d6ef6ee (diff)
downloadchromium_src-434af790c954aad57021a821a1e91daf5ae287fe.zip
chromium_src-434af790c954aad57021a821a1e91daf5ae287fe.tar.gz
chromium_src-434af790c954aad57021a821a1e91daf5ae287fe.tar.bz2
Revert 201688 "Remove NetworkStateInformer's dependency on Proxy..."
Speculative revert, trying to figure out what surfaces heap-use-after-free http://build.chromium.org/p/chromium.memory/builders/Chromium%20OS%20%28x86%29%20ASAN/builds/4565 See asan_log.4041.txt in VMTest stage. > Remove NetworkStateInformer's dependency on ProxyConfigServiceImpl. > > This also completes NetworkStateInformer's migration from NetworkLibrary to > NetworkStateHandler > > BUG=189009 > > Review URL: https://chromiumcodereview.appspot.com/15294010 TBR=pneubeck@chromium.org Review URL: https://codereview.chromium.org/15847002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201728 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/network')
-rw-r--r--chromeos/network/managed_state.h11
-rw-r--r--chromeos/network/network_state.cc40
-rw-r--r--chromeos/network/network_state.h11
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.