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

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

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

Powered by Google App Engine
This is Rietveld 408576698