summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/ui_proxy_config_service.cc
diff options
context:
space:
mode:
authorstevenjb <stevenjb@chromium.org>2015-03-14 11:32:24 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-14 18:33:09 +0000
commit82dbc53092955f8609b402be88183693d4e19718 (patch)
treefc74f613e096088a826bd8e22ee06b249bd047b9 /chrome/browser/chromeos/ui_proxy_config_service.cc
parent3aa113195dea4d4fcd20686d4414abb97c75f72a (diff)
downloadchromium_src-82dbc53092955f8609b402be88183693d4e19718.zip
chromium_src-82dbc53092955f8609b402be88183693d4e19718.tar.gz
chromium_src-82dbc53092955f8609b402be88183693d4e19718.tar.bz2
Use GUID instead of servicePath in network settings
* Uses guid instead of service path in the Internet Settings UI * Uses chrome://settings/internet?guid= instead of ?servicePath= * Uses chrome.networkingPrivate.getManagedProperties and setProperties directly in Internet Settings * Makes callback parameter optional in networkingPrivate for setters * Removes the difficult to maintain (and only partially implemented) Error translation from internet setigns, adding a general TODO for translating ONC properties in the UI. * Replaces ShowNetworkSettings with ShowNetworkSettingsForGuid in NetworkConnect::Delegate and ash::SystemTrayDelegate * Uses guid instead of service path in UIProxyConfigService BUG=467275 For chrome/browser/ui/ash: TBR=oshima@chromium.org Review URL: https://codereview.chromium.org/983823002 Cr-Commit-Position: refs/heads/master@{#320662}
Diffstat (limited to 'chrome/browser/chromeos/ui_proxy_config_service.cc')
-rw-r--r--chrome/browser/chromeos/ui_proxy_config_service.cc46
1 files changed, 22 insertions, 24 deletions
diff --git a/chrome/browser/chromeos/ui_proxy_config_service.cc b/chrome/browser/chromeos/ui_proxy_config_service.cc
index 490c043..83a0e5a 100644
--- a/chrome/browser/chromeos/ui_proxy_config_service.cc
+++ b/chrome/browser/chromeos/ui_proxy_config_service.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/chromeos/proxy_config_service_impl.h"
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
+#include "components/device_event_log/device_event_log.h"
#include "net/proxy/proxy_config.h"
namespace chromeos {
@@ -60,7 +61,7 @@ bool IsNetworkProxySettingsEditable(const onc::ONCSource onc_source) {
} // namespace
UIProxyConfigService::UIProxyConfigService()
- : profile_prefs_(NULL), local_state_prefs_(NULL) {
+ : profile_prefs_(nullptr), local_state_prefs_(nullptr) {
}
UIProxyConfigService::~UIProxyConfigService() {
@@ -72,23 +73,22 @@ void UIProxyConfigService::SetPrefs(PrefService* profile_prefs,
local_state_prefs_ = local_state_prefs;
}
-void UIProxyConfigService::SetCurrentNetwork(
- const std::string& current_network) {
- current_ui_network_ = current_network;
+void UIProxyConfigService::SetCurrentNetworkGuid(
+ const std::string& current_guid) {
+ current_ui_network_guid_ = current_guid;
}
void UIProxyConfigService::UpdateFromPrefs() {
- const NetworkState* network = NULL;
- if (!current_ui_network_.empty()) {
- network = NetworkHandler::Get()
- ->network_state_handler()
- ->GetNetworkStateFromServicePath(current_ui_network_,
- true /* configured_only */);
- LOG_IF(ERROR, !network) << "Couldn't find NetworkState for network "
- << current_ui_network_;
+ const NetworkState* network = nullptr;
+ if (!current_ui_network_guid_.empty()) {
+ network =
+ NetworkHandler::Get()->network_state_handler()->GetNetworkStateFromGuid(
+ current_ui_network_guid_);
}
- if (!network) {
- current_ui_network_.clear();
+ if (!network || !network->IsInProfile()) {
+ NET_LOG(ERROR) << "No configured NetworkState for guid: "
+ << current_ui_network_guid_;
+ current_ui_network_guid_.clear();
current_ui_config_ = UIProxyConfig();
return;
}
@@ -106,17 +106,15 @@ void UIProxyConfigService::GetProxyConfig(UIProxyConfig* config) const {
void UIProxyConfigService::SetProxyConfig(const UIProxyConfig& config) {
current_ui_config_ = config;
- if (current_ui_network_.empty())
+ if (current_ui_network_guid_.empty())
return;
const NetworkState* network =
- NetworkHandler::Get()
- ->network_state_handler()
- ->GetNetworkStateFromServicePath(current_ui_network_,
- true /* configured_only */);
- if (!network) {
- LOG(ERROR) << "Couldn't find NetworkState for network "
- << current_ui_network_;
+ NetworkHandler::Get()->network_state_handler()->GetNetworkStateFromGuid(
+ current_ui_network_guid_);
+ if (!network || !network->IsInProfile()) {
+ NET_LOG(ERROR) << "No configured NetworkState for guid: "
+ << current_ui_network_guid_;
return;
}
@@ -125,8 +123,8 @@ void UIProxyConfigService::SetProxyConfig(const UIProxyConfig& config) {
config.ToPrefProxyConfig());
ProxyConfigDictionary proxy_config_dict(proxy_config_value.get());
- VLOG(1) << "Set proxy for " << current_ui_network_
- << " to " << *proxy_config_value;
+ VLOG(1) << "Set proxy for " << current_ui_network_guid_ << " to "
+ << *proxy_config_value;
proxy_config::SetProxyConfigForNetwork(proxy_config_dict, *network);
current_ui_config_.state = ProxyPrefs::CONFIG_SYSTEM;