Chromium Code Reviews| OLD | NEW | 
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #ifndef CHROMEOS_DBUS_SYSTEM_CLOCK_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_SYSTEM_CLOCK_CLIENT_H_ | 
| 6 #define CHROMEOS_DBUS_SYSTEM_CLOCK_CLIENT_H_ | 6 #define CHROMEOS_DBUS_SYSTEM_CLOCK_CLIENT_H_ | 
| 7 | 7 | 
| 8 #include "base/callback.h" | |
| 8 #include "base/observer_list.h" | 9 #include "base/observer_list.h" | 
| 9 #include "chromeos/chromeos_export.h" | 10 #include "chromeos/chromeos_export.h" | 
| 10 #include "chromeos/dbus/dbus_client.h" | 11 #include "chromeos/dbus/dbus_client.h" | 
| 11 | 12 | 
| 12 namespace chromeos { | 13 namespace chromeos { | 
| 13 | 14 | 
| 14 // SystemClockClient is used to communicate with the system clock. | 15 // SystemClockClient is used to communicate with the system clock. | 
| 15 class CHROMEOS_EXPORT SystemClockClient : public DBusClient { | 16 class CHROMEOS_EXPORT SystemClockClient : public DBusClient { | 
| 16 public: | 17 public: | 
| 17 // Interface for observing changes from the system clock. | 18 // Interface for observing changes from the system clock. | 
| 18 class Observer { | 19 class Observer { | 
| 19 public: | 20 public: | 
| 20 // Called when the status is updated. | 21 // Called when the status is updated. | 
| 21 virtual void SystemClockUpdated() {} | 22 virtual void SystemClockUpdated(); | 
| 23 | |
| 24 // Called when the system clock has become settable or unsettable, e.g., | |
| 25 // when the clock syncs with or goes out of sync with the network. | |
| 26 virtual void SystemClockCanSetTimeChanged(bool can_set_time); | |
| 22 protected: | 27 protected: | 
| 23 virtual ~Observer() {} | 28 virtual ~Observer() {} | 
| 24 }; | 29 }; | 
| 25 | 30 | 
| 26 virtual ~SystemClockClient(); | 31 virtual ~SystemClockClient(); | 
| 27 | 32 | 
| 28 // Adds and removes the observer. | 33 // Adds and removes the observer. | 
| 29 virtual void AddObserver(Observer* observer) = 0; | 34 virtual void AddObserver(Observer* observer) = 0; | 
| 30 virtual void RemoveObserver(Observer* observer) = 0; | 35 virtual void RemoveObserver(Observer* observer) = 0; | 
| 31 // Returns true if this object has the given observer. | 36 // Returns true if this object has the given observer. | 
| 32 virtual bool HasObserver(Observer* observer) = 0; | 37 virtual bool HasObserver(Observer* observer) = 0; | 
| 33 | 38 | 
| 39 // Sets the system clock. | |
| 40 virtual void SetTime(int64 time_in_seconds) = 0; | |
| 
 
Daniel Erat
2014/04/23 16:33:22
use base::Time instead of int64
 
michaelpg
2014/04/24 01:32:23
Hmm. I would need to get "time in seconds since th
 
 | |
| 41 | |
| 42 // Checks if the system time can be set. | |
| 43 virtual bool CanSetTime() = 0; | |
| 44 | |
| 34 // Creates the instance. | 45 // Creates the instance. | 
| 35 static SystemClockClient* Create(); | 46 static SystemClockClient* Create(); | 
| 36 | 47 | 
| 37 protected: | 48 protected: | 
| 38 // Create() should be used instead. | 49 // Create() should be used instead. | 
| 39 SystemClockClient(); | 50 SystemClockClient(); | 
| 40 | 51 | 
| 41 private: | 52 private: | 
| 42 DISALLOW_COPY_AND_ASSIGN(SystemClockClient); | 53 DISALLOW_COPY_AND_ASSIGN(SystemClockClient); | 
| 43 }; | 54 }; | 
| 44 | 55 | 
| 45 } // namespace chromeos | 56 } // namespace chromeos | 
| 46 | 57 | 
| 47 #endif // CHROMEOS_DBUS_SYSTEM_CLOCK_CLIENT_H_ | 58 #endif // CHROMEOS_DBUS_SYSTEM_CLOCK_CLIENT_H_ | 
| OLD | NEW |