[Session restore] Rename group name Enabled to Restore.
[chromium-blink-merge.git] / chromeos / dbus / system_clock_client.h
blob3b84501325e79a922eb7800ad1ecc6456a21e6bb
1 // Copyright (c) 2013 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_SYSTEM_CLOCK_CLIENT_H_
6 #define CHROMEOS_DBUS_SYSTEM_CLOCK_CLIENT_H_
8 #include "base/callback.h"
9 #include "chromeos/chromeos_export.h"
10 #include "chromeos/dbus/dbus_client.h"
12 namespace chromeos {
14 // SystemClockClient is used to communicate with the system clock.
15 class CHROMEOS_EXPORT SystemClockClient : public DBusClient {
16 public:
17 // Interface for observing changes from the system clock.
18 class Observer {
19 public:
20 // Called when the status is updated.
21 virtual void SystemClockUpdated();
23 // Called when the system clock has become settable or unsettable, e.g.,
24 // when the clock syncs with or goes out of sync with the network.
25 virtual void SystemClockCanSetTimeChanged(bool can_set_time);
27 protected:
28 virtual ~Observer() {}
31 ~SystemClockClient() override;
33 // Adds the given observer.
34 virtual void AddObserver(Observer* observer) = 0;
35 // Removes the given observer if this object has the observer.
36 virtual void RemoveObserver(Observer* observer) = 0;
37 // Returns true if this object has the given observer.
38 virtual bool HasObserver(const Observer* observer) const = 0;
40 // Sets the system clock.
41 virtual void SetTime(int64 time_in_seconds) = 0;
43 // Checks if the system time can be set.
44 virtual bool CanSetTime() = 0;
46 // Creates the instance.
47 static SystemClockClient* Create();
49 protected:
50 // Create() should be used instead.
51 SystemClockClient();
53 private:
54 DISALLOW_COPY_AND_ASSIGN(SystemClockClient);
57 } // namespace chromeos
59 #endif // CHROMEOS_DBUS_SYSTEM_CLOCK_CLIENT_H_