OLD | NEW |
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 16 matching lines...) Expand all Loading... |
27 const char kNetworkStateCaptivePortal[] = "behind captive portal"; | 27 const char kNetworkStateCaptivePortal[] = "behind captive portal"; |
28 const char kNetworkStateConnecting[] = "connecting"; | 28 const char kNetworkStateConnecting[] = "connecting"; |
29 const char kNetworkStateProxyAuthRequired[] = "proxy auth required"; | 29 const char kNetworkStateProxyAuthRequired[] = "proxy auth required"; |
30 | 30 |
31 bool HasDefaultNetworkProxyConfigured() { | 31 bool HasDefaultNetworkProxyConfigured() { |
32 const NetworkState* network = | 32 const NetworkState* network = |
33 NetworkHandler::Get()->network_state_handler()->DefaultNetwork(); | 33 NetworkHandler::Get()->network_state_handler()->DefaultNetwork(); |
34 if (!network) | 34 if (!network) |
35 return false; | 35 return false; |
36 onc::ONCSource onc_source = onc::ONC_SOURCE_NONE; | 36 onc::ONCSource onc_source = onc::ONC_SOURCE_NONE; |
37 scoped_ptr<ProxyConfigDictionary> proxy_dict = | 37 std::unique_ptr<ProxyConfigDictionary> proxy_dict = |
38 proxy_config::GetProxyConfigForNetwork( | 38 proxy_config::GetProxyConfigForNetwork( |
39 NULL, g_browser_process->local_state(), *network, &onc_source); | 39 NULL, g_browser_process->local_state(), *network, &onc_source); |
40 ProxyPrefs::ProxyMode mode; | 40 ProxyPrefs::ProxyMode mode; |
41 return (proxy_dict && proxy_dict->GetMode(&mode) && | 41 return (proxy_dict && proxy_dict->GetMode(&mode) && |
42 mode == ProxyPrefs::MODE_FIXED_SERVERS); | 42 mode == ProxyPrefs::MODE_FIXED_SERVERS); |
43 } | 43 } |
44 | 44 |
45 NetworkStateInformer::State GetStateForDefaultNetwork() { | 45 NetworkStateInformer::State GetStateForDefaultNetwork() { |
46 const NetworkState* network = | 46 const NetworkState* network = |
47 NetworkHandler::Get()->network_state_handler()->DefaultNetwork(); | 47 NetworkHandler::Get()->network_state_handler()->DefaultNetwork(); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 SendStateToObservers(NetworkError::ERROR_REASON_UPDATE); | 203 SendStateToObservers(NetworkError::ERROR_REASON_UPDATE); |
204 } | 204 } |
205 | 205 |
206 void NetworkStateInformer::SendStateToObservers( | 206 void NetworkStateInformer::SendStateToObservers( |
207 NetworkError::ErrorReason reason) { | 207 NetworkError::ErrorReason reason) { |
208 FOR_EACH_OBSERVER(NetworkStateInformerObserver, observers_, | 208 FOR_EACH_OBSERVER(NetworkStateInformerObserver, observers_, |
209 UpdateState(reason)); | 209 UpdateState(reason)); |
210 } | 210 } |
211 | 211 |
212 } // namespace chromeos | 212 } // namespace chromeos |
OLD | NEW |