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

Side by Side Diff: ash/common/system/chromeos/network/tray_network_state_observer.h

Issue 2734653002: chromeos: Move files in //ash/common to //ash (Closed)
Patch Set: fix a11y tests, fix docs Created 3 years, 9 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
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 #ifndef ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_TRAY_NETWORK_STATE_OBSERVER_H_
6 #define ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_TRAY_NETWORK_STATE_OBSERVER_H_
7
8 #include "base/macros.h"
9 #include "base/timer/timer.h"
10 #include "chromeos/network/network_state_handler_observer.h"
11
12 namespace ash {
13
14 class TrayNetworkStateObserver : public chromeos::NetworkStateHandlerObserver {
15 public:
16 class Delegate {
17 public:
18 // Called when any interesting network changes occur. The frequency of this
19 // event is limited to kUpdateFrequencyMs.
20 virtual void NetworkStateChanged() = 0;
21
22 protected:
23 virtual ~Delegate() {}
24 };
25
26 explicit TrayNetworkStateObserver(Delegate* delegate);
27
28 ~TrayNetworkStateObserver() override;
29
30 // NetworkStateHandlerObserver overrides.
31 void NetworkListChanged() override;
32 void DeviceListChanged() override;
33 void DefaultNetworkChanged(const chromeos::NetworkState* network) override;
34 void NetworkConnectionStateChanged(
35 const chromeos::NetworkState* network) override;
36 void NetworkPropertiesUpdated(const chromeos::NetworkState* network) override;
37
38 private:
39 void SignalUpdate();
40 void SendNetworkStateChanged();
41
42 // Unowned Delegate pointer (must outlive this instance).
43 Delegate* delegate_;
44
45 // Set to true when we should purge stale icons in the cache.
46 bool purge_icons_;
47
48 // Frequency at which to push NetworkStateChanged updates. This avoids
49 // unnecessarily frequent UI updates (which can be expensive). We set this
50 // to 0 for tests to eliminate timing variance.
51 int update_frequency_;
52
53 // Timer used to limit the frequency of NetworkStateChanged updates.
54 base::OneShotTimer timer_;
55
56 DISALLOW_COPY_AND_ASSIGN(TrayNetworkStateObserver);
57 };
58
59 } // namespace ash
60
61 #endif // ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_TRAY_NETWORK_STATE_OBSERVER_H_
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/network/tray_network.cc ('k') | ash/common/system/chromeos/network/tray_network_state_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698