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

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: Rebased. 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/proxy_config_service_impl.h" 11 #include "chrome/browser/prefs/proxy_config_dictionary.h"
12 #include "chrome/browser/prefs/proxy_prefs.h"
12 #include "chrome/common/chrome_notification_types.h" 13 #include "chrome/common/chrome_notification_types.h"
14 #include "chromeos/network/network_state.h"
15 #include "chromeos/network/network_state_handler.h"
13 #include "net/proxy/proxy_config.h" 16 #include "net/proxy/proxy_config.h"
14 17
15 namespace { 18 namespace {
16 19
17 // Timeout to smooth temporary network state transitions for flaky networks. 20 // Timeout to smooth temporary network state transitions for flaky networks.
18 const int kNetworkStateCheckDelaySec = 3; 21 const int kNetworkStateCheckDelaySec = 3;
19 22
20 } // namespace 23 } // namespace
21 24
22 namespace chromeos { 25 namespace chromeos {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 if (network->online()) 203 if (network->online())
201 return ONLINE; 204 return ONLINE;
202 if (network->restricted_pool()) 205 if (network->restricted_pool())
203 return CAPTIVE_PORTAL; 206 return CAPTIVE_PORTAL;
204 } 207 }
205 return OFFLINE; 208 return OFFLINE;
206 } 209 }
207 210
208 bool NetworkStateInformer::IsProxyConfigured(const Network* network) { 211 bool NetworkStateInformer::IsProxyConfigured(const Network* network) {
209 DCHECK(network); 212 DCHECK(network);
210 ProxyStateMap::iterator it = proxy_state_map_.find(network->unique_id()); 213 const NetworkState* network_state =
211 if (it != proxy_state_map_.end() && 214 NetworkStateHandler::Get()->GetNetworkState(network->service_path());
212 it->second.proxy_config == network->proxy_config()) { 215 DCHECK(network_state);
stevenjb 2013/05/15 17:44:14 nit: Highly unlikely but not impossible, e.g. if t
pneubeck (no reviews) 2013/05/15 20:24:48 This is still waiting on Gaurav's commit. I should
213 return it->second.configured; 216
214 } 217 ProxyConfigDictionary proxy_dict(&network_state->proxy_config());
215 net::ProxyConfig proxy_config; 218 ProxyPrefs::ProxyMode mode;
216 if (!ProxyConfigServiceImpl::ParseProxyConfig(network, &proxy_config)) 219 return !proxy_dict.GetMode(&mode) || mode == ProxyPrefs::MODE_FIXED_SERVERS;
217 return false;
218 bool configured = !proxy_config.proxy_rules().empty();
219 proxy_state_map_[network->unique_id()] =
220 ProxyState(network->proxy_config(), configured);
221 return configured;
222 } 220 }
223 221
224 } // namespace chromeos 222 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698