diff options
author | jennyz@chromium.org <jennyz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-14 14:54:19 +0000 |
---|---|---|
committer | jennyz@chromium.org <jennyz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-14 14:54:19 +0000 |
commit | ce3b13abc2404989ad6f31959a60881f700dd26d (patch) | |
tree | ef7730fcd6cbae8f0577826b532bd66101f8868e /chromeos/dbus/system_clock_client.h | |
parent | d35992788a69b2ec9ae2ac8f00ca95285a2612d4 (diff) | |
download | chromium_src-ce3b13abc2404989ad6f31959a60881f700dd26d.zip chromium_src-ce3b13abc2404989ad6f31959a60881f700dd26d.tar.gz chromium_src-ce3b13abc2404989ad6f31959a60881f700dd26d.tar.bz2 |
Hook up system clock update dbus signal to chrome and ash tray ui. cros will send tlsdate.TimeUpdated dbus signal when system clock is updated from server, chrome will listen to the signal and update ash tray ui for time.
BUG=177970
Review URL: https://chromiumcodereview.appspot.com/12564007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188070 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/dbus/system_clock_client.h')
-rw-r--r-- | chromeos/dbus/system_clock_client.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/chromeos/dbus/system_clock_client.h b/chromeos/dbus/system_clock_client.h new file mode 100644 index 0000000..38158da --- /dev/null +++ b/chromeos/dbus/system_clock_client.h @@ -0,0 +1,52 @@ +// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMEOS_DBUS_SYSTEM_CLOCK_CLIENT_H_ +#define CHROMEOS_DBUS_SYSTEM_CLOCK_CLIENT_H_ + +#include "base/observer_list.h" +#include "chromeos/chromeos_export.h" +#include "chromeos/dbus/dbus_client_implementation_type.h" + +namespace dbus { +class Bus; +} // namespace + +namespace chromeos { + +// SystemClockClient is used to communicate with the system clock. +class CHROMEOS_EXPORT SystemClockClient { + public: + // Interface for observing changes from the system clock. + class Observer { + public: + // Called when the status is updated. + virtual void SystemClockUpdated() {} + protected: + virtual ~Observer() {} + }; + + virtual ~SystemClockClient(); + + // Adds and removes the observer. + virtual void AddObserver(Observer* observer) = 0; + virtual void RemoveObserver(Observer* observer) = 0; + // Returns true if this object has the given observer. + virtual bool HasObserver(Observer* observer) = 0; + + // Creates the instance. + static SystemClockClient* Create(DBusClientImplementationType type, + dbus::Bus* bus); + + protected: + // Create() should be used instead. + SystemClockClient(); + + private: + DISALLOW_COPY_AND_ASSIGN(SystemClockClient); +}; + +} // namespace chromeos + +#endif // CHROMEOS_DBUS_SYSTEM_CLOCK_CLIENT_H_ |