OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 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 CHROMEOS_DBUS_METRONOME_CLIENT_H_ | |
6 #define CHROMEOS_DBUS_METRONOME_CLIENT_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/callback_forward.h" | |
10 #include "chromeos/dbus/dbus_client.h" | |
11 #include "chromeos/dbus/dbus_client_implementation_type.h" | |
12 | |
13 namespace chromeos { | |
14 | |
15 // A DBus client class for the org.chromium.Metronome service. | |
16 class MetronomeClient : public DBusClient { | |
17 public: | |
18 // A callback to handle TimestampUpdated signal. | |
19 typedef base::Callback<void(uint64 beacon_timestamp, uint64 mac_timestamp)> | |
20 TimestampUpdatedHandler; | |
21 | |
22 virtual ~MetronomeClient(); | |
23 | |
24 // Registers |timestamp_updated_handler| as a callback to be invoked when a | |
25 // TimestampUpdated signal is received. | |
26 virtual void SetTimestampUpdatedHandler( | |
dtapuska
2015/02/18 13:59:12
I don't know if you want to use an Observer class
varkha
2015/02/18 18:21:17
Done (multiple observers part).
Ben Chan
2015/02/18 18:39:22
It depends. I generally use Delegate for situatio
varkha
2015/02/18 18:42:24
Yes, this is why I've added observers.
| |
27 const TimestampUpdatedHandler& timestamp_updated_handler) = 0; | |
28 | |
29 // Factory function, creates a new instance and returns ownership. | |
30 // For normal usage, access the singleton via DBusThreadManager::Get(). | |
31 static MetronomeClient* Create(DBusClientImplementationType type); | |
32 | |
33 protected: | |
34 // Create() should be used instead. | |
35 MetronomeClient(); | |
36 | |
37 private: | |
38 DISALLOW_COPY_AND_ASSIGN(MetronomeClient); | |
39 }; | |
40 | |
41 } // namespace chromeos | |
42 | |
43 #endif // CHROMEOS_DBUS_METRONOME_CLIENT_H_ | |
OLD | NEW |