| 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 #include "chromeos/dbus/system_clock_client.h" | 5 #include "chromeos/dbus/system_clock_client.h" |
| 6 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" |
| 8 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
| 9 #include "dbus/bus.h" | 12 #include "dbus/bus.h" |
| 10 #include "dbus/message.h" | 13 #include "dbus/message.h" |
| 11 #include "dbus/object_path.h" | 14 #include "dbus/object_path.h" |
| 12 #include "dbus/object_proxy.h" | 15 #include "dbus/object_proxy.h" |
| 13 #include "third_party/cros_system_api/dbus/service_constants.h" | 16 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 14 | 17 |
| 15 namespace chromeos { | 18 namespace chromeos { |
| 16 | 19 |
| 17 // The SystemClockClient implementation used in production. | 20 // The SystemClockClient implementation used in production. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 30 } | 33 } |
| 31 | 34 |
| 32 void RemoveObserver(Observer* observer) override { | 35 void RemoveObserver(Observer* observer) override { |
| 33 observers_.RemoveObserver(observer); | 36 observers_.RemoveObserver(observer); |
| 34 } | 37 } |
| 35 | 38 |
| 36 bool HasObserver(const Observer* observer) const override { | 39 bool HasObserver(const Observer* observer) const override { |
| 37 return observers_.HasObserver(observer); | 40 return observers_.HasObserver(observer); |
| 38 } | 41 } |
| 39 | 42 |
| 40 void SetTime(int64 time_in_seconds) override { | 43 void SetTime(int64_t time_in_seconds) override { |
| 41 // Always try to set the time, because |can_set_time_| may be stale. | 44 // Always try to set the time, because |can_set_time_| may be stale. |
| 42 dbus::MethodCall method_call(system_clock::kSystemClockInterface, | 45 dbus::MethodCall method_call(system_clock::kSystemClockInterface, |
| 43 system_clock::kSystemClockSet); | 46 system_clock::kSystemClockSet); |
| 44 dbus::MessageWriter writer(&method_call); | 47 dbus::MessageWriter writer(&method_call); |
| 45 writer.AppendInt64(time_in_seconds); | 48 writer.AppendInt64(time_in_seconds); |
| 46 system_clock_proxy_->CallMethod(&method_call, | 49 system_clock_proxy_->CallMethod(&method_call, |
| 47 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 50 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 48 dbus::ObjectProxy::EmptyResponseCallback()); | 51 dbus::ObjectProxy::EmptyResponseCallback()); |
| 49 } | 52 } |
| 50 | 53 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 152 |
| 150 SystemClockClient::~SystemClockClient() { | 153 SystemClockClient::~SystemClockClient() { |
| 151 } | 154 } |
| 152 | 155 |
| 153 // static | 156 // static |
| 154 SystemClockClient* SystemClockClient::Create() { | 157 SystemClockClient* SystemClockClient::Create() { |
| 155 return new SystemClockClientImpl(); | 158 return new SystemClockClientImpl(); |
| 156 } | 159 } |
| 157 | 160 |
| 158 } // namespace chromeos | 161 } // namespace chromeos |
| OLD | NEW |