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" |
(...skipping 18 matching lines...) Expand all Loading... |
29 // Always re-display for user initiated connections that fail. | 29 // Always re-display for user initiated connections that fail. |
30 // Always re-display the login dialog for encrypted networks that were | 30 // Always re-display the login dialog for encrypted networks that were |
31 // added and failed to connect for any reason. | 31 // added and failed to connect for any reason. |
32 VLOG(1) << "NotifyFailure: " << wifi->name() | 32 VLOG(1) << "NotifyFailure: " << wifi->name() |
33 << ", error: " << wifi->error() | 33 << ", error: " << wifi->error() |
34 << ", added: " << wifi->added(); | 34 << ", added: " << wifi->added(); |
35 if (wifi->error() == ERROR_BAD_PASSPHRASE || | 35 if (wifi->error() == ERROR_BAD_PASSPHRASE || |
36 wifi->error() == ERROR_BAD_WEPKEY || | 36 wifi->error() == ERROR_BAD_WEPKEY || |
37 wifi->connection_started() || | 37 wifi->connection_started() || |
38 (wifi->encrypted() && wifi->added())) { | 38 (wifi->encrypted() && wifi->added())) { |
39 NetworkConfigView::Show(wifi, NULL); | 39 NetworkConfigView::Show(wifi->service_path(), NULL); |
40 return; // Only support one failure per notification. | 40 return; // Only support one failure per notification. |
41 } | 41 } |
42 } | 42 } |
43 } | 43 } |
44 // Check to see if we have any newly failed wimax network. | 44 // Check to see if we have any newly failed wimax network. |
45 const WimaxNetworkVector& wimax_networks = cros->wimax_networks(); | 45 const WimaxNetworkVector& wimax_networks = cros->wimax_networks(); |
46 for (WimaxNetworkVector::const_iterator it = wimax_networks.begin(); | 46 for (WimaxNetworkVector::const_iterator it = wimax_networks.begin(); |
47 it != wimax_networks.end(); it++) { | 47 it != wimax_networks.end(); it++) { |
48 WimaxNetwork* wimax = *it; | 48 WimaxNetwork* wimax = *it; |
49 if (wimax->notify_failure()) { | 49 if (wimax->notify_failure()) { |
50 // Display login dialog again for bad_passphrase and bad_wepkey errors. | 50 // Display login dialog again for bad_passphrase and bad_wepkey errors. |
51 // Always re-display for user initiated connections that fail. | 51 // Always re-display for user initiated connections that fail. |
52 // Always re-display the login dialog for encrypted networks that were | 52 // Always re-display the login dialog for encrypted networks that were |
53 // added and failed to connect for any reason. | 53 // added and failed to connect for any reason. |
54 VLOG(1) << "NotifyFailure: " << wimax->name() | 54 VLOG(1) << "NotifyFailure: " << wimax->name() |
55 << ", error: " << wimax->error() | 55 << ", error: " << wimax->error() |
56 << ", added: " << wimax->added(); | 56 << ", added: " << wimax->added(); |
57 if (wimax->error() == ERROR_BAD_PASSPHRASE || | 57 if (wimax->error() == ERROR_BAD_PASSPHRASE || |
58 wimax->error() == ERROR_BAD_WEPKEY || | 58 wimax->error() == ERROR_BAD_WEPKEY || |
59 wimax->connection_started() || | 59 wimax->connection_started() || |
60 (wimax->passphrase_required() && wimax->added())) { | 60 (wimax->passphrase_required() && wimax->added())) { |
61 NetworkConfigView::Show(wimax, NULL); | 61 NetworkConfigView::Show(wimax->service_path(), NULL); |
62 return; // Only support one failure per notification. | 62 return; // Only support one failure per notification. |
63 } | 63 } |
64 } | 64 } |
65 } | 65 } |
66 // Check to see if we have any newly failed virtual network. | 66 // Check to see if we have any newly failed virtual network. |
67 const VirtualNetworkVector& virtual_networks = cros->virtual_networks(); | 67 const VirtualNetworkVector& virtual_networks = cros->virtual_networks(); |
68 for (VirtualNetworkVector::const_iterator it = virtual_networks.begin(); | 68 for (VirtualNetworkVector::const_iterator it = virtual_networks.begin(); |
69 it != virtual_networks.end(); it++) { | 69 it != virtual_networks.end(); it++) { |
70 VirtualNetwork* vpn = *it; | 70 VirtualNetwork* vpn = *it; |
71 if (vpn->notify_failure()) { | 71 if (vpn->notify_failure()) { |
72 VLOG(1) << "NotifyFailure: " << vpn->name() | 72 VLOG(1) << "NotifyFailure: " << vpn->name() |
73 << ", error: " << vpn->error() | 73 << ", error: " << vpn->error() |
74 << ", added: " << vpn->added(); | 74 << ", added: " << vpn->added(); |
75 // Display login dialog for any error or newly added network. | 75 // Display login dialog for any error or newly added network. |
76 if (vpn->error() != ERROR_NO_ERROR || vpn->added()) { | 76 if (vpn->error() != ERROR_NO_ERROR || vpn->added()) { |
77 NetworkConfigView::Show(vpn, NULL); | 77 NetworkConfigView::Show(vpn->service_path(), NULL); |
78 return; // Only support one failure per notification. | 78 return; // Only support one failure per notification. |
79 } | 79 } |
80 } | 80 } |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 } // namespace chromeos | 84 } // namespace chromeos |
OLD | NEW |