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

Side by Side Diff: chrome/browser/chromeos/network_login_observer.cc

Issue 22761002: Eliminate NetworkLoginObserver (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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
« no previous file with comments | « chrome/browser/chromeos/network_login_observer.h ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/network_login_observer.h"
6
7 #include "chrome/browser/chromeos/cros/network_library.h"
8 #include "chrome/browser/chromeos/options/network_config_view.h"
9 #include "chromeos/network/network_state_handler.h"
10 #include "ui/views/widget/widget.h"
11 #include "ui/views/widget/widget_delegate.h"
12
13 namespace chromeos {
14
15 NetworkLoginObserver::NetworkLoginObserver() {
16 }
17
18 NetworkLoginObserver::~NetworkLoginObserver() {
19 }
20
21 void NetworkLoginObserver::OnNetworkManagerChanged(NetworkLibrary* cros) {
22 // Check to see if we have any newly failed wifi network.
23 const WifiNetworkVector& wifi_networks = cros->wifi_networks();
24 for (WifiNetworkVector::const_iterator it = wifi_networks.begin();
25 it != wifi_networks.end(); it++) {
26 WifiNetwork* wifi = *it;
27 if (wifi->notify_failure()) {
28 // Display login dialog again for bad_passphrase and bad_wepkey errors.
29 // Always re-display for user initiated connections that fail.
30 // Always re-display the login dialog for encrypted networks that were
31 // added and failed to connect for any reason.
32 VLOG(1) << "NotifyFailure: " << wifi->name()
33 << ", error: " << wifi->error()
34 << ", added: " << wifi->added();
35 if (wifi->error() == ERROR_BAD_PASSPHRASE ||
36 wifi->error() == ERROR_BAD_WEPKEY ||
37 wifi->connection_started() ||
38 (wifi->encrypted() && wifi->added())) {
39 NetworkConfigView::Show(wifi->service_path(), NULL);
40 return; // Only support one failure per notification.
41 }
42 }
43 }
44 // Check to see if we have any newly failed wimax network.
45 const WimaxNetworkVector& wimax_networks = cros->wimax_networks();
46 for (WimaxNetworkVector::const_iterator it = wimax_networks.begin();
47 it != wimax_networks.end(); it++) {
48 WimaxNetwork* wimax = *it;
49 if (wimax->notify_failure()) {
50 // Display login dialog again for bad_passphrase and bad_wepkey errors.
51 // Always re-display for user initiated connections that fail.
52 // Always re-display the login dialog for encrypted networks that were
53 // added and failed to connect for any reason.
54 VLOG(1) << "NotifyFailure: " << wimax->name()
55 << ", error: " << wimax->error()
56 << ", added: " << wimax->added();
57 if (wimax->error() == ERROR_BAD_PASSPHRASE ||
58 wimax->error() == ERROR_BAD_WEPKEY ||
59 wimax->connection_started() ||
60 (wimax->passphrase_required() && wimax->added())) {
61 NetworkConfigView::Show(wimax->service_path(), NULL);
62 return; // Only support one failure per notification.
63 }
64 }
65 }
66 // Check to see if we have any newly failed virtual network.
67 const VirtualNetworkVector& virtual_networks = cros->virtual_networks();
68 for (VirtualNetworkVector::const_iterator it = virtual_networks.begin();
69 it != virtual_networks.end(); it++) {
70 VirtualNetwork* vpn = *it;
71 if (vpn->notify_failure()) {
72 VLOG(1) << "NotifyFailure: " << vpn->name()
73 << ", error: " << vpn->error()
74 << ", added: " << vpn->added();
75 // Display login dialog for any error or newly added network.
76 if (vpn->error() != ERROR_NO_ERROR || vpn->added()) {
77 NetworkConfigView::Show(vpn->service_path(), NULL);
78 return; // Only support one failure per notification.
79 }
80 }
81 }
82 }
83
84 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/network_login_observer.h ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698