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_TRAY_NETWORK_STATE_OBSERVER_H | 5 #ifndef ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_NETWORK_STATE_OBSERVER_H |
6 #define ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_NETWORK_STATE_OBSERVER_H | 6 #define ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_NETWORK_STATE_OBSERVER_H |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "chromeos/network/network_state_handler_observer.h" | 11 #include "chromeos/network/network_state_handler_observer.h" |
12 | 12 |
13 namespace ash { | 13 namespace ash { |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 class TrayNetwork; | |
17 | |
18 class TrayNetworkStateObserver : public chromeos::NetworkStateHandlerObserver { | 16 class TrayNetworkStateObserver : public chromeos::NetworkStateHandlerObserver { |
19 public: | 17 public: |
20 enum WifiState { | 18 class Delegate { |
21 WIFI_DISABLED, | 19 public: |
22 WIFI_ENABLED, | 20 // Called when the network state may have changed. If |list_changed| is |
23 WIFI_UNKNOWN, | 21 // true then the list of networks may have changed. |
| 22 virtual void NetworkStateChanged(bool list_changed) = 0; |
| 23 |
| 24 // Called when the properties for |network| may have been updated. |
| 25 virtual void NetworkServiceChanged( |
| 26 const chromeos::NetworkState* network) = 0; |
| 27 |
| 28 protected: |
| 29 virtual ~Delegate() {} |
24 }; | 30 }; |
25 | 31 |
26 explicit TrayNetworkStateObserver(TrayNetwork* tray); | 32 explicit TrayNetworkStateObserver(Delegate* delegate); |
27 | 33 |
28 virtual ~TrayNetworkStateObserver(); | 34 virtual ~TrayNetworkStateObserver(); |
29 | 35 |
30 // NetworkStateHandlerObserver overrides. | 36 // NetworkStateHandlerObserver overrides. |
31 virtual void NetworkManagerChanged() OVERRIDE; | 37 virtual void NetworkManagerChanged() OVERRIDE; |
32 virtual void NetworkListChanged() OVERRIDE; | 38 virtual void NetworkListChanged() OVERRIDE; |
33 virtual void DeviceListChanged() OVERRIDE; | 39 virtual void DeviceListChanged() OVERRIDE; |
34 virtual void DefaultNetworkChanged( | 40 virtual void DefaultNetworkChanged( |
35 const chromeos::NetworkState* network) OVERRIDE; | 41 const chromeos::NetworkState* network) OVERRIDE; |
36 virtual void NetworkPropertiesUpdated( | 42 virtual void NetworkPropertiesUpdated( |
37 const chromeos::NetworkState* network) OVERRIDE; | 43 const chromeos::NetworkState* network) OVERRIDE; |
38 | 44 |
| 45 // Keep track of user initiated connecting networks |
| 46 static void AddConnectingNetwork(const std::string& service_path); |
| 47 |
| 48 // Returns true if a user initiated connection to |network| occured |
| 49 static bool HasConnectingNetwork(const std::string& service_path); |
| 50 |
39 private: | 51 private: |
40 TrayNetwork* tray_; | 52 Delegate* delegate_; |
41 WifiState wifi_state_; // cache wifi enabled state | |
42 | 53 |
43 DISALLOW_COPY_AND_ASSIGN(TrayNetworkStateObserver); | 54 DISALLOW_COPY_AND_ASSIGN(TrayNetworkStateObserver); |
44 }; | 55 }; |
45 | 56 |
46 } // namespace ash | 57 } // namespace ash |
47 } // namespace internal | 58 } // namespace internal |
48 | 59 |
49 #endif // ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_NETWORK_STATE_OBSERVER_H | 60 #endif // ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_NETWORK_STATE_OBSERVER_H |
OLD | NEW |