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.
5 #ifndef CHROMEOS_DBUS_METRONOME_CLIENT_H_
6 #define CHROMEOS_DBUS_METRONOME_CLIENT_H_
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"
17 // A DBus client class for the org.chromium.Metronome service.
18 class CHROMEOS_EXPORT MetronomeClient
: public DBusClient
{
20 // Interface for observing timestamp events from a metronome client.
23 // Called when the TimestampUpdated signal is received.
24 virtual void OnTimestampUpdated(uint64 beacon_timestamp
,
25 uint64 local_timestamp
) = 0;
26 virtual ~Observer() {}
29 ~MetronomeClient() override
;
31 // Adds and removes observers for timestamp events.
32 virtual void AddObserver(Observer
* observer
) = 0;
33 virtual void RemoveObserver(Observer
* observer
) = 0;
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
);
40 // Create() should be used instead.
44 DISALLOW_COPY_AND_ASSIGN(MetronomeClient
);
47 } // namespace chromeos
49 #endif // CHROMEOS_DBUS_METRONOME_CLIENT_H_