| 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 "base/timer/timer.h" |
| 11 #include "chromeos/network/network_state_handler_observer.h" | 12 #include "chromeos/network/network_state_handler_observer.h" |
| 12 | 13 |
| 13 namespace ash { | 14 namespace ash { |
| 14 | 15 |
| 15 class TrayNetworkStateObserver : public chromeos::NetworkStateHandlerObserver { | 16 class TrayNetworkStateObserver : public chromeos::NetworkStateHandlerObserver { |
| 16 public: | 17 public: |
| 17 class Delegate { | 18 class Delegate { |
| 18 public: | 19 public: |
| 19 // Called when the network state may have changed. If |list_changed| is | 20 // Called when any interesting network changes occur. The frequency of this |
| 20 // true then the list of networks may have changed. | 21 // event is limited to kUpdateFrequencyMs. |
| 21 virtual void NetworkStateChanged(bool list_changed) = 0; | 22 virtual void NetworkStateChanged() = 0; |
| 22 | |
| 23 // Called when the properties for |network| may have been updated. | |
| 24 virtual void NetworkServiceChanged( | |
| 25 const chromeos::NetworkState* network) = 0; | |
| 26 | 23 |
| 27 protected: | 24 protected: |
| 28 virtual ~Delegate() {} | 25 virtual ~Delegate() {} |
| 29 }; | 26 }; |
| 30 | 27 |
| 31 explicit TrayNetworkStateObserver(Delegate* delegate); | 28 explicit TrayNetworkStateObserver(Delegate* delegate); |
| 32 | 29 |
| 33 virtual ~TrayNetworkStateObserver(); | 30 ~TrayNetworkStateObserver() override; |
| 34 | 31 |
| 35 // NetworkStateHandlerObserver overrides. | 32 // NetworkStateHandlerObserver overrides. |
| 36 virtual void NetworkListChanged() override; | 33 void NetworkListChanged() override; |
| 37 virtual void DeviceListChanged() override; | 34 void DeviceListChanged() override; |
| 38 virtual void DefaultNetworkChanged( | 35 void DefaultNetworkChanged(const chromeos::NetworkState* network) override; |
| 36 void NetworkConnectionStateChanged( |
| 39 const chromeos::NetworkState* network) override; | 37 const chromeos::NetworkState* network) override; |
| 40 virtual void NetworkConnectionStateChanged( | 38 void NetworkPropertiesUpdated(const chromeos::NetworkState* network) override; |
| 41 const chromeos::NetworkState* network) override; | |
| 42 virtual void NetworkPropertiesUpdated( | |
| 43 const chromeos::NetworkState* network) override; | |
| 44 | 39 |
| 45 private: | 40 private: |
| 46 Delegate* delegate_; | 41 Delegate* delegate_; |
| 42 bool purge_icons_; |
| 43 base::OneShotTimer<TrayNetworkStateObserver> timer_; |
| 44 |
| 45 void SignalUpdate(); |
| 46 void SendNetworkStateChanged(); |
| 47 | 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(TrayNetworkStateObserver); | 48 DISALLOW_COPY_AND_ASSIGN(TrayNetworkStateObserver); |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 } // namespace ash | 51 } // namespace ash |
| 52 | 52 |
| 53 #endif // ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_NETWORK_STATE_OBSERVER_H | 53 #endif // ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_NETWORK_STATE_OBSERVER_H |
| OLD | NEW |