OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 "base/memory/ref_counted.h" |
| 11 #include "chromeos/chromeos_export.h" |
| 12 #include "chromeos/dbus/dbus_client.h" |
| 13 #include "chromeos/dbus/dbus_client_implementation_type.h" |
| 14 |
| 15 namespace chromeos { |
| 16 |
| 17 // A DBus client class for the org.chromium.Metronome service. |
| 18 class CHROMEOS_EXPORT MetronomeClient : public DBusClient { |
| 19 public: |
| 20 // Interface for observing timestamp events from a metronome client. |
| 21 class Observer { |
| 22 public: |
| 23 // Called when the TimestampUpdated signal is received. |
| 24 virtual void OnTimestampUpdated(uint64 beacon_timestamp, |
| 25 uint64 local_timestamp) = 0; |
| 26 virtual ~Observer() {} |
| 27 }; |
| 28 |
| 29 ~MetronomeClient() override; |
| 30 |
| 31 // Adds and removes observers for timestamp events. |
| 32 virtual void AddObserver(Observer* observer) = 0; |
| 33 virtual void RemoveObserver(Observer* observer) = 0; |
| 34 |
| 35 // Factory function, creates a new instance and returns ownership. |
| 36 // For normal usage, access the singleton via DBusThreadManager::Get(). |
| 37 static MetronomeClient* Create(DBusClientImplementationType type); |
| 38 |
| 39 protected: |
| 40 // Create() should be used instead. |
| 41 MetronomeClient(); |
| 42 |
| 43 private: |
| 44 DISALLOW_COPY_AND_ASSIGN(MetronomeClient); |
| 45 }; |
| 46 |
| 47 } // namespace chromeos |
| 48 |
| 49 #endif // CHROMEOS_DBUS_METRONOME_CLIENT_H_ |
OLD | NEW |