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/chromeos/network_login_observer.h" | 5 #include "chrome/browser/chromeos/network_login_observer.h" |
6 | 6 |
7 #include "chrome/browser/chromeos/cros/network_library.h" | 7 #include "chrome/browser/chromeos/cros/network_library.h" |
8 #include "chrome/browser/chromeos/options/network_config_view.h" | 8 #include "chrome/browser/chromeos/options/network_config_view.h" |
9 #include "chromeos/network/network_state_handler.h" | 9 #include "chromeos/network/network_state_handler.h" |
10 #include "ui/views/widget/widget.h" | 10 #include "ui/views/widget/widget.h" |
11 #include "ui/views/widget/widget_delegate.h" | 11 #include "ui/views/widget/widget_delegate.h" |
12 | 12 |
13 namespace chromeos { | 13 namespace chromeos { |
14 | 14 |
15 NetworkLoginObserver::NetworkLoginObserver() { | 15 NetworkLoginObserver::NetworkLoginObserver() { |
16 // CertLoader does not get initialized in many unit tests even though | 16 // NetworkHandler does not get initialized in many unit tests even though |
17 // NetworkLibrary which owns this class does. TODO(stevenjb): Eliminate | 17 // NetworkLibrary which owns this class does. TODO(stevenjb): Eliminate |
18 // this class along with NetworkLibrary, crbug.com/154852. | 18 // this class along with NetworkLibrary, crbug.com/154852. |
19 if (CertLoader::IsInitialized()) | 19 if (NetworkHandler::IsInitialized()) |
20 CertLoader::Get()->AddObserver(this); | 20 NetworkHandler::Get()->cert_loader()->AddObserver(this); |
21 } | 21 } |
22 | 22 |
23 NetworkLoginObserver::~NetworkLoginObserver() { | 23 NetworkLoginObserver::~NetworkLoginObserver() { |
24 if (CertLoader::IsInitialized()) | 24 if (NetworkHandler::IsInitialized()) |
25 CertLoader::Get()->RemoveObserver(this); | 25 NetworkHandler::Get()->cert_loader()->RemoveObserver(this); |
26 } | 26 } |
27 | 27 |
28 void NetworkLoginObserver::OnNetworkManagerChanged(NetworkLibrary* cros) { | 28 void NetworkLoginObserver::OnNetworkManagerChanged(NetworkLibrary* cros) { |
29 // Check to see if we have any newly failed wifi network. | 29 // Check to see if we have any newly failed wifi network. |
30 const WifiNetworkVector& wifi_networks = cros->wifi_networks(); | 30 const WifiNetworkVector& wifi_networks = cros->wifi_networks(); |
31 for (WifiNetworkVector::const_iterator it = wifi_networks.begin(); | 31 for (WifiNetworkVector::const_iterator it = wifi_networks.begin(); |
32 it != wifi_networks.end(); it++) { | 32 it != wifi_networks.end(); it++) { |
33 WifiNetwork* wifi = *it; | 33 WifiNetwork* wifi = *it; |
34 if (wifi->notify_failure()) { | 34 if (wifi->notify_failure()) { |
35 // Display login dialog again for bad_passphrase and bad_wepkey errors. | 35 // Display login dialog again for bad_passphrase and bad_wepkey errors. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 } | 86 } |
87 } | 87 } |
88 } | 88 } |
89 } | 89 } |
90 | 90 |
91 void NetworkLoginObserver::OnCertificatesLoaded( | 91 void NetworkLoginObserver::OnCertificatesLoaded( |
92 const net::CertificateList& cert_list, | 92 const net::CertificateList& cert_list, |
93 bool initial_load) { | 93 bool initial_load) { |
94 if (initial_load) { | 94 if (initial_load) { |
95 // Once certificates have loaded, connect to the "best" available network. | 95 // Once certificates have loaded, connect to the "best" available network. |
96 NetworkStateHandler::Get()->ConnectToBestWifiNetwork(); | 96 NetworkHandler::Get()->network_state_handler()->ConnectToBestWifiNetwork(); |
97 } | 97 } |
98 } | 98 } |
99 | 99 |
100 } // namespace chromeos | 100 } // namespace chromeos |
OLD | NEW |