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

Side by Side Diff: chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc

Issue 8102019: redesign and reimplement proxy config service and tracker, revise proxy ui on cros (Closed) Base URL: svn://chrome-svn/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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/chromeos/proxy_settings_ui.h" 5 #include "chrome/browser/ui/webui/chromeos/proxy_settings_ui.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/chromeos/cros_settings.h" 10 #include "chrome/browser/chromeos/cros_settings.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 SendResponse(request_id, base::RefCountedString::TakeString(&full_html)); 59 SendResponse(request_id, base::RefCountedString::TakeString(&full_html));
60 } 60 }
61 61
62 } // namespace 62 } // namespace
63 63
64 namespace chromeos { 64 namespace chromeos {
65 65
66 ProxySettingsUI::ProxySettingsUI(TabContents* contents) 66 ProxySettingsUI::ProxySettingsUI(TabContents* contents)
67 : ChromeWebUI(contents), 67 : ChromeWebUI(contents),
68 proxy_settings_(NULL), 68 proxy_settings_(NULL),
69 proxy_handler_(new ProxyHandler) { 69 proxy_handler_(new ProxyHandler(GetProfile())) {
70 // |localized_strings| will be owned by ProxySettingsHTMLSource. 70 // |localized_strings| will be owned by ProxySettingsHTMLSource.
71 DictionaryValue* localized_strings = new DictionaryValue(); 71 DictionaryValue* localized_strings = new DictionaryValue();
72 72
73 CoreChromeOSOptionsHandler* core_handler = new CoreChromeOSOptionsHandler(); 73 CoreChromeOSOptionsHandler* core_handler = new CoreChromeOSOptionsHandler();
74 core_handler->set_handlers_host(this); 74 core_handler->set_handlers_host(this);
75 core_handler->GetLocalizedValues(localized_strings); 75 core_handler->GetLocalizedValues(localized_strings);
76 AddMessageHandler(core_handler->Attach(this)); 76 AddMessageHandler(core_handler->Attach(this));
77 77
78 proxy_handler_->GetLocalizedValues(localized_strings); 78 proxy_handler_->GetLocalizedValues(localized_strings);
79 AddMessageHandler(proxy_handler_->Attach(this)); 79 AddMessageHandler(proxy_handler_->Attach(this));
(...skipping 16 matching lines...) Expand all
96 } 96 }
97 97
98 void ProxySettingsUI::InitializeHandlers() { 98 void ProxySettingsUI::InitializeHandlers() {
99 std::vector<WebUIMessageHandler*>::iterator iter; 99 std::vector<WebUIMessageHandler*>::iterator iter;
100 // Skip over the generic handler. 100 // Skip over the generic handler.
101 for (iter = handlers_.begin() + 1; iter != handlers_.end(); ++iter) { 101 for (iter = handlers_.begin() + 1; iter != handlers_.end(); ++iter) {
102 (static_cast<OptionsPageUIHandler*>(*iter))->Initialize(); 102 (static_cast<OptionsPageUIHandler*>(*iter))->Initialize();
103 } 103 }
104 if (proxy_settings()) { 104 if (proxy_settings()) {
105 proxy_settings()->MakeActiveNetworkCurrent(); 105 proxy_settings()->MakeActiveNetworkCurrent();
106 std::string network = proxy_settings()->GetCurrentNetworkName(); 106 std::string network_name;
107 if (!network.empty()) 107 GetProfile()->GetProxyConfigTracker()->UIGetCurrentNetworkName(
108 proxy_handler_->SetNetworkName(network); 108 &network_name);
109 proxy_handler_->SetNetworkName(network_name);
109 } 110 }
110 } 111 }
111 112
112 chromeos::ProxyCrosSettingsProvider* ProxySettingsUI::proxy_settings() { 113 chromeos::ProxyCrosSettingsProvider* ProxySettingsUI::proxy_settings() {
113 if (!proxy_settings_) { 114 if (!proxy_settings_) {
114 proxy_settings_ = static_cast<chromeos::ProxyCrosSettingsProvider*>( 115 proxy_settings_ = static_cast<chromeos::ProxyCrosSettingsProvider*>(
115 chromeos::CrosSettings::Get()->GetProvider("cros.session.proxy")); 116 chromeos::CrosSettings::Get()->GetProvider("cros.session.proxy"));
116 if (!proxy_settings_) 117 if (!proxy_settings_)
117 NOTREACHED() << "Error getting access to proxy cros settings provider"; 118 NOTREACHED() << "Error getting access to proxy cros settings provider";
118 } 119 }
119 return proxy_settings_; 120 return proxy_settings_;
120 } 121 }
121 122
122 } // namespace chromeos 123 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698