Index: chromeos/dbus/metronome_client.h |
diff --git a/chromeos/dbus/metronome_client.h b/chromeos/dbus/metronome_client.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6725894bc14d1767c79a5965ce7c79bd6fc2e601 |
--- /dev/null |
+++ b/chromeos/dbus/metronome_client.h |
@@ -0,0 +1,43 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROMEOS_DBUS_METRONOME_CLIENT_H_ |
+#define CHROMEOS_DBUS_METRONOME_CLIENT_H_ |
+ |
+#include "base/basictypes.h" |
+#include "base/callback_forward.h" |
+#include "chromeos/dbus/dbus_client.h" |
+#include "chromeos/dbus/dbus_client_implementation_type.h" |
+ |
+namespace chromeos { |
+ |
+// A DBus client class for the org.chromium.Metronome service. |
+class MetronomeClient : public DBusClient { |
+ public: |
+ // A callback to handle TimestampUpdated signal. |
+ typedef base::Callback<void(uint64 beacon_timestamp, uint64 mac_timestamp)> |
+ TimestampUpdatedHandler; |
+ |
+ virtual ~MetronomeClient(); |
+ |
+ // Registers |timestamp_updated_handler| as a callback to be invoked when a |
+ // TimestampUpdated signal is received. |
+ 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.
|
+ const TimestampUpdatedHandler& timestamp_updated_handler) = 0; |
+ |
+ // Factory function, creates a new instance and returns ownership. |
+ // For normal usage, access the singleton via DBusThreadManager::Get(). |
+ static MetronomeClient* Create(DBusClientImplementationType type); |
+ |
+ protected: |
+ // Create() should be used instead. |
+ MetronomeClient(); |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(MetronomeClient); |
+}; |
+ |
+} // namespace chromeos |
+ |
+#endif // CHROMEOS_DBUS_METRONOME_CLIENT_H_ |