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

Side by Side Diff: ui/chromeos/network/network_state_notifier.h

Issue 762633002: Use NetworkConnectionObserver to trigger connect failure notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
OLDNEW
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 #ifndef UI_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_ 5 #ifndef UI_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_
6 #define UI_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_ 6 #define UI_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "chromeos/network/network_connection_observer.h"
15 #include "chromeos/network/network_state_handler_observer.h" 16 #include "chromeos/network/network_state_handler_observer.h"
16 #include "ui/chromeos/ui_chromeos_export.h" 17 #include "ui/chromeos/ui_chromeos_export.h"
17 18
18 namespace base { 19 namespace base {
19 class DictionaryValue; 20 class DictionaryValue;
20 } 21 }
21 22
22 namespace chromeos { 23 namespace chromeos {
23 class NetworkState; 24 class NetworkState;
24 } 25 }
25 26
26 namespace ui { 27 namespace ui {
27 28
28 class NetworkConnect; 29 class NetworkConnect;
29 30
30 // This class has two purposes: 31 // This class has two purposes:
31 // 1. ShowNetworkConnectError() gets called after any user initiated connect 32 // 1. ShowNetworkConnectError() gets called after any user initiated connect
32 // failure. This will handle displaying an error notification. 33 // failure. This will handle displaying an error notification.
33 // TODO(stevenjb): convert this class to use the new MessageCenter 34 // TODO(stevenjb): convert this class to use the new MessageCenter
34 // notification system. 35 // notification system.
35 // 2. It observes NetworkState changes to generate notifications when a 36 // 2. It observes NetworkState changes to generate notifications when a
36 // Cellular network is out of credits. 37 // Cellular network is out of credits.
37 class UI_CHROMEOS_EXPORT NetworkStateNotifier : 38 class UI_CHROMEOS_EXPORT NetworkStateNotifier :
39 public chromeos::NetworkConnectionObserver,
38 public chromeos::NetworkStateHandlerObserver { 40 public chromeos::NetworkStateHandlerObserver {
39 public: 41 public:
40 explicit NetworkStateNotifier(NetworkConnect* network_connect); 42 explicit NetworkStateNotifier(NetworkConnect* network_connect);
41 virtual ~NetworkStateNotifier(); 43 ~NetworkStateNotifier() override;
44
45 // NetworkConnectionObserver
46 void ConnectFailed(const std::string& service_path,
47 const std::string& error_name) override;
42 48
43 // NetworkStateHandlerObserver 49 // NetworkStateHandlerObserver
44 virtual void DefaultNetworkChanged( 50 void DefaultNetworkChanged(const chromeos::NetworkState* network) override;
45 const chromeos::NetworkState* network) override; 51 void NetworkPropertiesUpdated(const chromeos::NetworkState* network) override;
46 virtual void NetworkPropertiesUpdated(
47 const chromeos::NetworkState* network) override;
48 52
49 // Show a connection error notification. If |error_name| matches an error 53 // Show a connection error notification. If |error_name| matches an error
50 // defined in NetworkConnectionHandler for connect, configure, or activation 54 // defined in NetworkConnectionHandler for connect, configure, or activation
51 // failed, then the associated message is shown; otherwise use the last_error 55 // failed, then the associated message is shown; otherwise use the last_error
52 // value for the network or a Shill property if available. 56 // value for the network or a Shill property if available.
53 void ShowNetworkConnectError(const std::string& error_name, 57 void ShowNetworkConnectError(const std::string& error_name,
54 const std::string& service_path); 58 const std::string& service_path);
55 59
56 // Show a mobile activation error notification. 60 // Show a mobile activation error notification.
57 void ShowMobileActivationError(const std::string& service_path); 61 void ShowMobileActivationError(const std::string& service_path);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 base::Time out_of_credits_notify_time_; 100 base::Time out_of_credits_notify_time_;
97 std::set<std::string> cellular_activating_; 101 std::set<std::string> cellular_activating_;
98 base::WeakPtrFactory<NetworkStateNotifier> weak_ptr_factory_; 102 base::WeakPtrFactory<NetworkStateNotifier> weak_ptr_factory_;
99 103
100 DISALLOW_COPY_AND_ASSIGN(NetworkStateNotifier); 104 DISALLOW_COPY_AND_ASSIGN(NetworkStateNotifier);
101 }; 105 };
102 106
103 } // namespace ui 107 } // namespace ui
104 108
105 #endif // UI_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_ 109 #endif // UI_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698