OLD | NEW |
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 proxy_handler_ = NULL; // Weak ptr that is owned by base class, nullify it. | 95 proxy_handler_ = NULL; // Weak ptr that is owned by base class, nullify it. |
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()->MakeActiveNetworkCurrentWithProfile(GetProfile()); |
106 std::string network = proxy_settings()->GetCurrentNetworkName(); | 106 std::string network = proxy_settings()->GetCurrentNetworkName(); |
107 if (!network.empty()) | 107 proxy_handler_->SetNetworkName(network); |
108 proxy_handler_->SetNetworkName(network); | |
109 } | 108 } |
110 } | 109 } |
111 | 110 |
112 chromeos::ProxyCrosSettingsProvider* ProxySettingsUI::proxy_settings() { | 111 chromeos::ProxyCrosSettingsProvider* ProxySettingsUI::proxy_settings() { |
113 if (!proxy_settings_) { | 112 if (!proxy_settings_) { |
114 proxy_settings_ = static_cast<chromeos::ProxyCrosSettingsProvider*>( | 113 proxy_settings_ = static_cast<chromeos::ProxyCrosSettingsProvider*>( |
115 chromeos::CrosSettings::Get()->GetProvider("cros.session.proxy")); | 114 chromeos::CrosSettings::Get()->GetProvider("cros.session.proxy")); |
116 if (!proxy_settings_) | 115 if (!proxy_settings_) |
117 NOTREACHED() << "Error getting access to proxy cros settings provider"; | 116 NOTREACHED() << "Error getting access to proxy cros settings provider"; |
118 } | 117 } |
119 return proxy_settings_; | 118 return proxy_settings_; |
120 } | 119 } |
121 | 120 |
122 } // namespace chromeos | 121 } // namespace chromeos |
OLD | NEW |