summaryrefslogtreecommitdiffstats
path: root/chromeos/network/network_state.cc
diff options
context:
space:
mode:
authorpneubeck@chromium.org <pneubeck@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-01 15:44:56 +0000
committerpneubeck@chromium.org <pneubeck@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-01 15:44:56 +0000
commit7be0abbd8ad0b5d1d5f20dd0145e387006c588c4 (patch)
treeed5b4983cf0f5a5297dffe2b866acdb53132383e /chromeos/network/network_state.cc
parent6118f96b6a4a2e172e6f8ed4f297b8748cd22cd3 (diff)
downloadchromium_src-7be0abbd8ad0b5d1d5f20dd0145e387006c588c4.zip
chromium_src-7be0abbd8ad0b5d1d5f20dd0145e387006c588c4.tar.gz
chromium_src-7be0abbd8ad0b5d1d5f20dd0145e387006c588c4.tar.bz2
Refactor access to the ONC policy for a network.
Instead of relying on a value stored in Shill (namely, onc_source in UIData) and caching that in NetworkState, directly access the new ONC preference in Chrome to check whether a network is managed or not. Proxy settings worked already in that way. With this change internet_options_handler uses the same code path. The only functional change is that a policy indicator will also be visible in the NetworkList of chrome://settings if Ethernet is managed. BUG=126870 (for API changes; network_state_informer.cc, preferences_browsertest.cc) R=bartfab@chromium.org, stevenjb@chromium.org TBR=nkostylev@chromium.org, ygorshenin@chromium.org Review URL: https://codereview.chromium.org/23609047 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@226237 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/network/network_state.cc')
-rw-r--r--chromeos/network/network_state.cc30
1 files changed, 1 insertions, 29 deletions
diff --git a/chromeos/network/network_state.cc b/chromeos/network/network_state.cc
index 3a0a1fb..6c41f41 100644
--- a/chromeos/network/network_state.cc
+++ b/chromeos/network/network_state.cc
@@ -5,10 +5,10 @@
#include "chromeos/network/network_state.h"
#include "base/strings/stringprintf.h"
+#include "base/values.h"
#include "chromeos/network/network_event_log.h"
#include "chromeos/network/network_profile_handler.h"
#include "chromeos/network/network_util.h"
-#include "chromeos/network/onc/onc_utils.h"
#include "chromeos/network/shill_property_util.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
@@ -126,29 +126,6 @@ bool NetworkState::PropertyChanged(const std::string& key,
return GetStringValue(key, value, &roaming_);
} else if (key == shill::kSecurityProperty) {
return GetStringValue(key, value, &security_);
- } else if (key == shill::kProxyConfigProperty) {
- std::string proxy_config_str;
- if (!value.GetAsString(&proxy_config_str)) {
- NET_LOG_ERROR("Failed to parse " + key, path());
- 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 returned 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 {
- NET_LOG_ERROR("Failed to parse " + key, path());
- }
- return true;
} else if (key == shill::kUIDataProperty) {
scoped_ptr<NetworkUIData> new_ui_data =
shill_property_util::GetUIDataFromValue(value);
@@ -253,11 +230,6 @@ bool NetworkState::IsConnectingState() const {
return StateIsConnecting(connection_state_);
}
-bool NetworkState::IsManaged() const {
- return ui_data_.onc_source() == onc::ONC_SOURCE_DEVICE_POLICY ||
- ui_data_.onc_source() == onc::ONC_SOURCE_USER_POLICY;
-}
-
bool NetworkState::IsPrivate() const {
return !profile_path_.empty() &&
profile_path_ != NetworkProfileHandler::kSharedProfilePath;