| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/power_manager_client.h" | 5 #include "chromeos/dbus/power_manager_client.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 power_manager_proxy_->CallMethod( | 248 power_manager_proxy_->CallMethod( |
| 249 &method_call, | 249 &method_call, |
| 250 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 250 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 251 dbus::ObjectProxy::EmptyResponseCallback()); | 251 dbus::ObjectProxy::EmptyResponseCallback()); |
| 252 } | 252 } |
| 253 | 253 |
| 254 virtual void RequestActiveNotification() OVERRIDE { | 254 virtual void RequestActiveNotification() OVERRIDE { |
| 255 RequestIdleNotification(0); | 255 RequestIdleNotification(0); |
| 256 } | 256 } |
| 257 | 257 |
| 258 virtual void NotifyUserActivity( |
| 259 const base::TimeTicks& last_activity_time) OVERRIDE { |
| 260 dbus::MethodCall method_call( |
| 261 power_manager::kPowerManagerInterface, |
| 262 power_manager::kHandleUserActivityMethod); |
| 263 dbus::MessageWriter writer(&method_call); |
| 264 writer.AppendInt64(last_activity_time.ToInternalValue()); |
| 265 power_manager_proxy_->CallMethod( |
| 266 &method_call, |
| 267 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 268 dbus::ObjectProxy::EmptyResponseCallback()); |
| 269 } |
| 270 |
| 258 virtual void NotifyVideoActivity( | 271 virtual void NotifyVideoActivity( |
| 259 const base::TimeTicks& last_activity_time) OVERRIDE { | 272 const base::TimeTicks& last_activity_time) OVERRIDE { |
| 260 dbus::MethodCall method_call( | 273 dbus::MethodCall method_call( |
| 261 power_manager::kPowerManagerInterface, | 274 power_manager::kPowerManagerInterface, |
| 262 power_manager::kHandleVideoActivityMethod); | 275 power_manager::kHandleVideoActivityMethod); |
| 263 dbus::MessageWriter writer(&method_call); | 276 dbus::MessageWriter writer(&method_call); |
| 264 writer.AppendInt64(last_activity_time.ToInternalValue()); | 277 writer.AppendInt64(last_activity_time.ToInternalValue()); |
| 265 power_manager_proxy_->CallMethod( | 278 power_manager_proxy_->CallMethod( |
| 266 &method_call, | 279 &method_call, |
| 267 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 280 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 virtual void RequestRestart() OVERRIDE {} | 720 virtual void RequestRestart() OVERRIDE {} |
| 708 virtual void RequestShutdown() OVERRIDE {} | 721 virtual void RequestShutdown() OVERRIDE {} |
| 709 | 722 |
| 710 virtual void CalculateIdleTime(const CalculateIdleTimeCallback& callback) | 723 virtual void CalculateIdleTime(const CalculateIdleTimeCallback& callback) |
| 711 OVERRIDE { | 724 OVERRIDE { |
| 712 callback.Run(0); | 725 callback.Run(0); |
| 713 } | 726 } |
| 714 | 727 |
| 715 virtual void RequestIdleNotification(int64 threshold) OVERRIDE {} | 728 virtual void RequestIdleNotification(int64 threshold) OVERRIDE {} |
| 716 virtual void RequestActiveNotification() OVERRIDE {} | 729 virtual void RequestActiveNotification() OVERRIDE {} |
| 730 virtual void NotifyUserActivity( |
| 731 const base::TimeTicks& last_activity_time) OVERRIDE {} |
| 717 virtual void NotifyVideoActivity( | 732 virtual void NotifyVideoActivity( |
| 718 const base::TimeTicks& last_activity_time) OVERRIDE {} | 733 const base::TimeTicks& last_activity_time) OVERRIDE {} |
| 719 virtual void RequestPowerStateOverrides( | 734 virtual void RequestPowerStateOverrides( |
| 720 uint32 request_id, | 735 uint32 request_id, |
| 721 uint32 duration, | 736 uint32 duration, |
| 722 int overrides, | 737 int overrides, |
| 723 const PowerStateRequestIdCallback& callback) OVERRIDE {} | 738 const PowerStateRequestIdCallback& callback) OVERRIDE {} |
| 724 | 739 |
| 725 virtual void NotifyScreenLockRequested() OVERRIDE { | 740 virtual void NotifyScreenLockRequested() OVERRIDE { |
| 726 screen_locked_ = true; | 741 screen_locked_ = true; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 PowerManagerClient* PowerManagerClient::Create( | 809 PowerManagerClient* PowerManagerClient::Create( |
| 795 DBusClientImplementationType type, | 810 DBusClientImplementationType type, |
| 796 dbus::Bus* bus) { | 811 dbus::Bus* bus) { |
| 797 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 812 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
| 798 return new PowerManagerClientImpl(bus); | 813 return new PowerManagerClientImpl(bus); |
| 799 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); | 814 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); |
| 800 return new PowerManagerClientStubImpl(); | 815 return new PowerManagerClientStubImpl(); |
| 801 } | 816 } |
| 802 | 817 |
| 803 } // namespace chromeos | 818 } // namespace chromeos |
| OLD | NEW |