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 #ifndef ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_ | 5 #ifndef ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_ |
6 #define ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_ | 6 #define ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 11 #include "ash/system/chromeos/network/network_tray_delegate.h" |
11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/time.h" |
13 #include "chromeos/network/network_state_handler_observer.h" | 15 #include "chromeos/network/network_state_handler_observer.h" |
14 | 16 |
15 namespace ash { | 17 namespace ash { |
16 namespace internal { | 18 namespace internal { |
17 | 19 |
18 // This class observes NetworkStateHandler and generates notifications | 20 // This class observes NetworkStateHandler and generates notifications |
19 // on connection failures. | 21 // on connection failures. |
20 class ASH_EXPORT NetworkStateNotifier : | 22 class ASH_EXPORT NetworkStateNotifier : |
21 public chromeos::NetworkStateHandlerObserver { | 23 public chromeos::NetworkStateHandlerObserver, |
| 24 public NetworkTrayDelegate { |
22 public: | 25 public: |
23 NetworkStateNotifier(); | 26 NetworkStateNotifier(); |
24 virtual ~NetworkStateNotifier(); | 27 virtual ~NetworkStateNotifier(); |
25 | 28 |
26 // NetworkStateHandlerObserver | 29 // NetworkStateHandlerObserver |
| 30 virtual void DefaultNetworkChanged( |
| 31 const chromeos::NetworkState* network) OVERRIDE; |
27 virtual void NetworkConnectionStateChanged( | 32 virtual void NetworkConnectionStateChanged( |
28 const chromeos::NetworkState* network) OVERRIDE; | 33 const chromeos::NetworkState* network) OVERRIDE; |
| 34 virtual void NetworkPropertiesUpdated( |
| 35 const chromeos::NetworkState* network) OVERRIDE; |
| 36 |
| 37 // NetworkTrayDelegate |
| 38 virtual void NotificationLinkClicked( |
| 39 NetworkObserver::MessageType message_type, |
| 40 size_t link_index) OVERRIDE; |
29 | 41 |
30 private: | 42 private: |
31 typedef std::map<std::string, std::string> CachedStateMap; | 43 typedef std::map<std::string, std::string> CachedStateMap; |
32 | 44 |
33 void InitializeNetworks(); | 45 void InitializeNetworks(); |
34 | 46 |
35 CachedStateMap cached_state_; | 47 CachedStateMap cached_state_; |
| 48 std::string last_default_network_; |
| 49 std::string cellular_network_; |
| 50 bool cellular_out_of_credits_; |
| 51 base::Time out_of_credits_notify_time_; |
36 | 52 |
37 DISALLOW_COPY_AND_ASSIGN(NetworkStateNotifier); | 53 DISALLOW_COPY_AND_ASSIGN(NetworkStateNotifier); |
38 }; | 54 }; |
39 | 55 |
40 } // namespace internal | 56 } // namespace internal |
41 } // namespace ash | 57 } // namespace ash |
42 | 58 |
43 #endif // ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_ | 59 #endif // ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_ |
OLD | NEW |