Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(942)

Unified Diff: chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc

Issue 8467012: Refactor proxy handling for ChromeOS to not go through the CrosSettings interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc
diff --git a/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc b/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc
index 8c06afbb5cfc486ad87be590213b31906c49acf8..86633a1f9a4f75a730230341cfc3936e58813e81 100644
--- a/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc
@@ -8,13 +8,16 @@
#include "base/message_loop.h"
#include "base/values.h"
#include "chrome/browser/chromeos/cros_settings.h"
+#include "chrome/browser/chromeos/proxy_config_service_impl.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
#include "chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.h"
#include "chrome/browser/ui/webui/options/chromeos/proxy_handler.h"
+#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/jstemplate_builder.h"
#include "chrome/common/url_constants.h"
#include "content/browser/tab_contents/tab_contents.h"
+#include "content/public/browser/notification_service.h"
#include "grit/browser_resources.h"
#include "ui/base/resource/resource_bundle.h"
@@ -65,8 +68,7 @@ namespace chromeos {
ProxySettingsUI::ProxySettingsUI(TabContents* contents)
: ChromeWebUI(contents),
- proxy_settings_(NULL),
- proxy_handler_(new ProxyHandler(GetProfile())) {
+ proxy_handler_(new ProxyHandler()) {
// |localized_strings| will be owned by ProxySettingsHTMLSource.
DictionaryValue* localized_strings = new DictionaryValue();
@@ -101,23 +103,15 @@ void ProxySettingsUI::InitializeHandlers() {
for (iter = handlers_.begin() + 1; iter != handlers_.end(); ++iter) {
(static_cast<OptionsPageUIHandler*>(*iter))->Initialize();
}
- if (proxy_settings()) {
- proxy_settings()->MakeActiveNetworkCurrent();
- std::string network_name;
- GetProfile()->GetProxyConfigTracker()->UIGetCurrentNetworkName(
- &network_name);
- proxy_handler_->SetNetworkName(network_name);
- }
-}
-
-chromeos::ProxyCrosSettingsProvider* ProxySettingsUI::proxy_settings() {
- if (!proxy_settings_) {
- proxy_settings_ = static_cast<chromeos::ProxyCrosSettingsProvider*>(
- chromeos::CrosSettings::Get()->GetProvider("cros.session.proxy"));
- if (!proxy_settings_)
- NOTREACHED() << "Error getting access to proxy cros settings provider";
- }
- return proxy_settings_;
+ GetProfile()->GetProxyConfigTracker()->UIMakeActiveNetworkCurrent();
+ std::string network_name;
+ GetProfile()->GetProxyConfigTracker()->UIGetCurrentNetworkName(
+ &network_name);
+ content::NotificationService::current()->Notify(
+ chrome::NOTIFICATION_CURRENT_NETWORK_CHANGED,
+ content::NotificationService::AllSources(),
+ content::NotificationService::NoDetails());
+ proxy_handler_->SetNetworkName(network_name);
}
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698