diff options
author | pneubeck@chromium.org <pneubeck@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-01 15:44:56 +0000 |
---|---|---|
committer | pneubeck@chromium.org <pneubeck@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-01 15:44:56 +0000 |
commit | 7be0abbd8ad0b5d1d5f20dd0145e387006c588c4 (patch) | |
tree | ed5b4983cf0f5a5297dffe2b866acdb53132383e /chrome/browser/chromeos/ui_proxy_config_service.cc | |
parent | 6118f96b6a4a2e172e6f8ed4f297b8748cd22cd3 (diff) | |
download | chromium_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 'chrome/browser/chromeos/ui_proxy_config_service.cc')
-rw-r--r-- | chrome/browser/chromeos/ui_proxy_config_service.cc | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/chrome/browser/chromeos/ui_proxy_config_service.cc b/chrome/browser/chromeos/ui_proxy_config_service.cc index d607c0e..66195090 100644 --- a/chrome/browser/chromeos/ui_proxy_config_service.cc +++ b/chrome/browser/chromeos/ui_proxy_config_service.cc @@ -9,7 +9,7 @@ #include "base/values.h" #include "chrome/browser/chromeos/net/proxy_config_handler.h" #include "chrome/browser/chromeos/proxy_config_service_impl.h" -#include "chromeos/network/network_state.h" +#include "chromeos/network/favorite_state.h" #include "chromeos/network/network_state_handler.h" #include "grit/generated_resources.h" #include "net/proxy/proxy_config.h" @@ -40,11 +40,11 @@ const char* ModeToString(UIProxyConfig::Mode mode) { // for this network. bool GetProxyConfig(const PrefService* profile_prefs, const PrefService* local_state_prefs, - const NetworkState& network, + const FavoriteState& network, net::ProxyConfig* proxy_config, onc::ONCSource* onc_source) { scoped_ptr<ProxyConfigDictionary> proxy_dict = - proxy_config::GetProxyConfigForNetwork( + proxy_config::GetProxyConfigForFavoriteNetwork( profile_prefs, local_state_prefs, network, onc_source); if (!proxy_dict) return false; @@ -79,11 +79,11 @@ void UIProxyConfigService::SetCurrentNetwork( } void UIProxyConfigService::UpdateFromPrefs() { - const NetworkState* network = NULL; + const FavoriteState* network = NULL; if (!current_ui_network_.empty()) { - network = NetworkHandler::Get()->network_state_handler() - ->GetNetworkState(current_ui_network_); - LOG_IF(ERROR, !network) << "Can't find requested network " + network = NetworkHandler::Get()->network_state_handler()->GetFavoriteState( + current_ui_network_); + LOG_IF(ERROR, !network) << "Couldn't find FavoriteState for network " << current_ui_network_; } if (!network) { @@ -108,11 +108,12 @@ void UIProxyConfigService::SetProxyConfig(const UIProxyConfig& config) { if (current_ui_network_.empty()) return; - const NetworkState* network = - NetworkHandler::Get()->network_state_handler()-> - GetNetworkState(current_ui_network_); + const FavoriteState* network = + NetworkHandler::Get()->network_state_handler()->GetFavoriteState( + current_ui_network_); if (!network) { - LOG(ERROR) << "Can't find requested network " << current_ui_network_; + LOG(ERROR) << "Couldn't find FavoriteState for network " + << current_ui_network_; return; } @@ -124,12 +125,12 @@ void UIProxyConfigService::SetProxyConfig(const UIProxyConfig& config) { VLOG(1) << "Set proxy for " << current_ui_network_ << " to " << *proxy_config_value; - proxy_config::SetProxyConfigForNetwork(proxy_config_dict, *network); + proxy_config::SetProxyConfigForFavoriteNetwork(proxy_config_dict, *network); current_ui_config_.state = ProxyPrefs::CONFIG_SYSTEM; } void UIProxyConfigService::DetermineEffectiveConfig( - const NetworkState& network) { + const FavoriteState& network) { DCHECK(local_state_prefs_); // The pref service to read proxy settings that apply to all networks. |