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

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

Issue 289383004: Merge FavoriteState into NetworkState (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Elim UpdateManagerProperties, feedback Created 6 years, 6 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/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 10 matching lines...) Expand all
21 21
22 namespace { 22 namespace {
23 23
24 const char kNetworkStateOffline[] = "offline"; 24 const char kNetworkStateOffline[] = "offline";
25 const char kNetworkStateOnline[] = "online"; 25 const char kNetworkStateOnline[] = "online";
26 const char kNetworkStateCaptivePortal[] = "behind captive portal"; 26 const char kNetworkStateCaptivePortal[] = "behind captive portal";
27 const char kNetworkStateConnecting[] = "connecting"; 27 const char kNetworkStateConnecting[] = "connecting";
28 const char kNetworkStateProxyAuthRequired[] = "proxy auth required"; 28 const char kNetworkStateProxyAuthRequired[] = "proxy auth required";
29 29
30 bool HasDefaultNetworkProxyConfigured() { 30 bool HasDefaultNetworkProxyConfigured() {
31 const FavoriteState* favorite = 31 const NetworkState* network =
32 NetworkHandler::Get()->network_state_handler()->DefaultFavoriteNetwork(); 32 NetworkHandler::Get()->network_state_handler()->DefaultNetwork();
33 if (!favorite) 33 if (!network)
34 return false; 34 return false;
35 onc::ONCSource onc_source = onc::ONC_SOURCE_NONE; 35 onc::ONCSource onc_source = onc::ONC_SOURCE_NONE;
36 scoped_ptr<ProxyConfigDictionary> proxy_dict = 36 scoped_ptr<ProxyConfigDictionary> proxy_dict =
37 proxy_config::GetProxyConfigForFavoriteNetwork( 37 proxy_config::GetProxyConfigForNetwork(
38 NULL, g_browser_process->local_state(), *favorite, &onc_source); 38 NULL, g_browser_process->local_state(), *network, &onc_source);
39 ProxyPrefs::ProxyMode mode; 39 ProxyPrefs::ProxyMode mode;
40 return (proxy_dict && proxy_dict->GetMode(&mode) && 40 return (proxy_dict && proxy_dict->GetMode(&mode) &&
41 mode == ProxyPrefs::MODE_FIXED_SERVERS); 41 mode == ProxyPrefs::MODE_FIXED_SERVERS);
42 } 42 }
43 43
44 NetworkStateInformer::State GetStateForDefaultNetwork() { 44 NetworkStateInformer::State GetStateForDefaultNetwork() {
45 const NetworkState* network = 45 const NetworkState* network =
46 NetworkHandler::Get()->network_state_handler()->DefaultNetwork(); 46 NetworkHandler::Get()->network_state_handler()->DefaultNetwork();
47 if (!network) 47 if (!network)
48 return NetworkStateInformer::OFFLINE; 48 return NetworkStateInformer::OFFLINE;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 SendStateToObservers(ErrorScreenActor::ERROR_REASON_UPDATE); 201 SendStateToObservers(ErrorScreenActor::ERROR_REASON_UPDATE);
202 } 202 }
203 203
204 void NetworkStateInformer::SendStateToObservers( 204 void NetworkStateInformer::SendStateToObservers(
205 ErrorScreenActor::ErrorReason reason) { 205 ErrorScreenActor::ErrorReason reason) {
206 FOR_EACH_OBSERVER(NetworkStateInformerObserver, observers_, 206 FOR_EACH_OBSERVER(NetworkStateInformerObserver, observers_,
207 UpdateState(reason)); 207 UpdateState(reason));
208 } 208 }
209 209
210 } // namespace chromeos 210 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698