| 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/cros_library.h" | |
| 8 #include "chrome/browser/chromeos/cros/network_library.h" | 7 #include "chrome/browser/chromeos/cros/network_library.h" |
| 9 #include "chrome/browser/chromeos/options/network_config_view.h" | 8 #include "chrome/browser/chromeos/options/network_config_view.h" |
| 10 #include "ui/views/widget/widget.h" | 9 #include "ui/views/widget/widget.h" |
| 11 #include "ui/views/widget/widget_delegate.h" | 10 #include "ui/views/widget/widget_delegate.h" |
| 12 | 11 |
| 13 namespace chromeos { | 12 namespace chromeos { |
| 14 | 13 |
| 15 NetworkLoginObserver::NetworkLoginObserver(NetworkLibrary* netlib) { | 14 NetworkLoginObserver::NetworkLoginObserver() { |
| 16 netlib->AddNetworkManagerObserver(this); | |
| 17 } | 15 } |
| 18 | 16 |
| 19 NetworkLoginObserver::~NetworkLoginObserver() { | 17 NetworkLoginObserver::~NetworkLoginObserver() { |
| 20 CrosLibrary::Get()->GetNetworkLibrary()->RemoveNetworkManagerObserver(this); | |
| 21 } | 18 } |
| 22 | 19 |
| 23 void NetworkLoginObserver::OnNetworkManagerChanged(NetworkLibrary* cros) { | 20 void NetworkLoginObserver::OnNetworkManagerChanged(NetworkLibrary* cros) { |
| 24 // Check to see if we have any newly failed wifi network. | 21 // Check to see if we have any newly failed wifi network. |
| 25 const WifiNetworkVector& wifi_networks = cros->wifi_networks(); | 22 const WifiNetworkVector& wifi_networks = cros->wifi_networks(); |
| 26 for (WifiNetworkVector::const_iterator it = wifi_networks.begin(); | 23 for (WifiNetworkVector::const_iterator it = wifi_networks.begin(); |
| 27 it != wifi_networks.end(); it++) { | 24 it != wifi_networks.end(); it++) { |
| 28 WifiNetwork* wifi = *it; | 25 WifiNetwork* wifi = *it; |
| 29 if (wifi->notify_failure()) { | 26 if (wifi->notify_failure()) { |
| 30 // Display login dialog again for bad_passphrase and bad_wepkey errors. | 27 // Display login dialog again for bad_passphrase and bad_wepkey errors. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // Display login dialog for any error or newly added network. | 74 // Display login dialog for any error or newly added network. |
| 78 if (vpn->error() != ERROR_NO_ERROR || vpn->added()) { | 75 if (vpn->error() != ERROR_NO_ERROR || vpn->added()) { |
| 79 NetworkConfigView::Show(vpn, NULL); | 76 NetworkConfigView::Show(vpn, NULL); |
| 80 return; // Only support one failure per notification. | 77 return; // Only support one failure per notification. |
| 81 } | 78 } |
| 82 } | 79 } |
| 83 } | 80 } |
| 84 } | 81 } |
| 85 | 82 |
| 86 } // namespace chromeos | 83 } // namespace chromeos |
| OLD | NEW |