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

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

Issue 14846004: Migrate ProxyConfigServiceImpl to NetworkStateHandler and NetworkProfileHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initial patch. Created 7 years, 7 months 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/login/network_state_informer.h" 5 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "chrome/browser/chromeos/cros/cros_library.h" 10 #include "chrome/browser/chromeos/cros/cros_library.h"
11 #include "chrome/browser/chromeos/login/screens/error_screen_actor.h" 11 #include "chrome/browser/chromeos/login/screens/error_screen_actor.h"
12 #include "chrome/browser/chromeos/proxy_config_service_impl.h" 12 #include "chrome/browser/chromeos/proxy_config_service_impl.h"
13 #include "chrome/common/chrome_notification_types.h" 13 #include "chrome/common/chrome_notification_types.h"
14 #include "chromeos/network/network_state_handler.h"
14 #include "net/proxy/proxy_config.h" 15 #include "net/proxy/proxy_config.h"
15 16
16 namespace { 17 namespace {
17 18
18 // Timeout to smooth temporary network state transitions for flaky networks. 19 // Timeout to smooth temporary network state transitions for flaky networks.
19 const int kNetworkStateCheckDelaySec = 3; 20 const int kNetworkStateCheckDelaySec = 3;
20 21
21 } // namespace 22 } // namespace
22 23
23 namespace chromeos { 24 namespace chromeos {
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 if (network->online()) 204 if (network->online())
204 return ONLINE; 205 return ONLINE;
205 if (network->restricted_pool()) 206 if (network->restricted_pool())
206 return CAPTIVE_PORTAL; 207 return CAPTIVE_PORTAL;
207 } 208 }
208 return OFFLINE; 209 return OFFLINE;
209 } 210 }
210 211
211 bool NetworkStateInformer::IsProxyConfigured(const Network* network) { 212 bool NetworkStateInformer::IsProxyConfigured(const Network* network) {
212 DCHECK(network); 213 DCHECK(network);
213 ProxyStateMap::iterator it = proxy_state_map_.find(network->unique_id()); 214 const NetworkState* network_state =
214 if (it != proxy_state_map_.end() && 215 NetworkStateHandler::Get()->GetNetworkState(network->service_path());
215 it->second.proxy_config == network->proxy_config()) { 216 DCHECK(network_state);
216 return it->second.configured; 217
218 net::ProxyConfig proxy_config;
219 if (!ProxyConfigServiceImpl::ParseProxyConfig(*network_state,
220 &proxy_config)) {
221 return false;
217 } 222 }
218 net::ProxyConfig proxy_config; 223 return !proxy_config.proxy_rules().empty();
219 if (!ProxyConfigServiceImpl::ParseProxyConfig(network, &proxy_config))
220 return false;
221 bool configured = !proxy_config.proxy_rules().empty();
222 proxy_state_map_[network->unique_id()] =
223 ProxyState(network->proxy_config(), configured);
224 return configured;
225 } 224 }
226 225
227 } // namespace chromeos 226 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698