| 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/observer_list.h" | 8 #include "base/observer_list.h" |
| 9 #include "chromeos/chromeos_export.h" | 9 #include "chromeos/chromeos_export.h" |
| 10 #include "chromeos/dbus/dbus_client.h" | 10 #include "chromeos/dbus/dbus_client.h" |
| 11 #include "chromeos/dbus/dbus_client_implementation_type.h" | |
| 12 | 11 |
| 13 namespace chromeos { | 12 namespace chromeos { |
| 14 | 13 |
| 15 // SystemClockClient is used to communicate with the system clock. | 14 // SystemClockClient is used to communicate with the system clock. |
| 16 class CHROMEOS_EXPORT SystemClockClient : public DBusClient { | 15 class CHROMEOS_EXPORT SystemClockClient : public DBusClient { |
| 17 public: | 16 public: |
| 18 // Interface for observing changes from the system clock. | 17 // Interface for observing changes from the system clock. |
| 19 class Observer { | 18 class Observer { |
| 20 public: | 19 public: |
| 21 // Called when the status is updated. | 20 // Called when the status is updated. |
| 22 virtual void SystemClockUpdated() {} | 21 virtual void SystemClockUpdated() {} |
| 23 protected: | 22 protected: |
| 24 virtual ~Observer() {} | 23 virtual ~Observer() {} |
| 25 }; | 24 }; |
| 26 | 25 |
| 27 virtual ~SystemClockClient(); | 26 virtual ~SystemClockClient(); |
| 28 | 27 |
| 29 // Adds and removes the observer. | 28 // Adds and removes the observer. |
| 30 virtual void AddObserver(Observer* observer) = 0; | 29 virtual void AddObserver(Observer* observer) = 0; |
| 31 virtual void RemoveObserver(Observer* observer) = 0; | 30 virtual void RemoveObserver(Observer* observer) = 0; |
| 32 // Returns true if this object has the given observer. | 31 // Returns true if this object has the given observer. |
| 33 virtual bool HasObserver(Observer* observer) = 0; | 32 virtual bool HasObserver(Observer* observer) = 0; |
| 34 | 33 |
| 35 // Creates the instance. | 34 // Creates the instance. |
| 36 static SystemClockClient* Create(DBusClientImplementationType type); | 35 static SystemClockClient* Create(); |
| 37 | 36 |
| 38 protected: | 37 protected: |
| 39 // Create() should be used instead. | 38 // Create() should be used instead. |
| 40 SystemClockClient(); | 39 SystemClockClient(); |
| 41 | 40 |
| 42 private: | 41 private: |
| 43 DISALLOW_COPY_AND_ASSIGN(SystemClockClient); | 42 DISALLOW_COPY_AND_ASSIGN(SystemClockClient); |
| 44 }; | 43 }; |
| 45 | 44 |
| 46 } // namespace chromeos | 45 } // namespace chromeos |
| 47 | 46 |
| 48 #endif // CHROMEOS_DBUS_SYSTEM_CLOCK_CLIENT_H_ | 47 #endif // CHROMEOS_DBUS_SYSTEM_CLOCK_CLIENT_H_ |
| OLD | NEW |