| 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 power_manager_proxy_->CallMethod( | 232 power_manager_proxy_->CallMethod( |
| 233 &method_call, | 233 &method_call, |
| 234 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 234 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 235 dbus::ObjectProxy::EmptyResponseCallback()); | 235 dbus::ObjectProxy::EmptyResponseCallback()); |
| 236 } | 236 } |
| 237 | 237 |
| 238 virtual void RequestActiveNotification() OVERRIDE { | 238 virtual void RequestActiveNotification() OVERRIDE { |
| 239 RequestIdleNotification(0); | 239 RequestIdleNotification(0); |
| 240 } | 240 } |
| 241 | 241 |
| 242 virtual void NotifyUserActivity( |
| 243 const base::TimeTicks& last_activity_time) OVERRIDE { |
| 244 dbus::MethodCall method_call( |
| 245 power_manager::kPowerManagerInterface, |
| 246 power_manager::kHandleUserActivityMethod); |
| 247 dbus::MessageWriter writer(&method_call); |
| 248 writer.AppendInt64(last_activity_time.ToInternalValue()); |
| 249 power_manager_proxy_->CallMethod( |
| 250 &method_call, |
| 251 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 252 dbus::ObjectProxy::EmptyResponseCallback()); |
| 253 } |
| 254 |
| 242 virtual void NotifyVideoActivity( | 255 virtual void NotifyVideoActivity( |
| 243 const base::TimeTicks& last_activity_time) OVERRIDE { | 256 const base::TimeTicks& last_activity_time) OVERRIDE { |
| 244 dbus::MethodCall method_call( | 257 dbus::MethodCall method_call( |
| 245 power_manager::kPowerManagerInterface, | 258 power_manager::kPowerManagerInterface, |
| 246 power_manager::kHandleVideoActivityMethod); | 259 power_manager::kHandleVideoActivityMethod); |
| 247 dbus::MessageWriter writer(&method_call); | 260 dbus::MessageWriter writer(&method_call); |
| 248 writer.AppendInt64(last_activity_time.ToInternalValue()); | 261 writer.AppendInt64(last_activity_time.ToInternalValue()); |
| 249 power_manager_proxy_->CallMethod( | 262 power_manager_proxy_->CallMethod( |
| 250 &method_call, | 263 &method_call, |
| 251 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 264 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 virtual void RequestRestart() OVERRIDE {} | 659 virtual void RequestRestart() OVERRIDE {} |
| 647 virtual void RequestShutdown() OVERRIDE {} | 660 virtual void RequestShutdown() OVERRIDE {} |
| 648 | 661 |
| 649 virtual void CalculateIdleTime(const CalculateIdleTimeCallback& callback) | 662 virtual void CalculateIdleTime(const CalculateIdleTimeCallback& callback) |
| 650 OVERRIDE { | 663 OVERRIDE { |
| 651 callback.Run(0); | 664 callback.Run(0); |
| 652 } | 665 } |
| 653 | 666 |
| 654 virtual void RequestIdleNotification(int64 threshold) OVERRIDE {} | 667 virtual void RequestIdleNotification(int64 threshold) OVERRIDE {} |
| 655 virtual void RequestActiveNotification() OVERRIDE {} | 668 virtual void RequestActiveNotification() OVERRIDE {} |
| 669 virtual void NotifyUserActivity( |
| 670 const base::TimeTicks& last_activity_time) OVERRIDE {} |
| 656 virtual void NotifyVideoActivity( | 671 virtual void NotifyVideoActivity( |
| 657 const base::TimeTicks& last_activity_time) OVERRIDE {} | 672 const base::TimeTicks& last_activity_time) OVERRIDE {} |
| 658 virtual void RequestPowerStateOverrides( | 673 virtual void RequestPowerStateOverrides( |
| 659 uint32 request_id, | 674 uint32 request_id, |
| 660 uint32 duration, | 675 uint32 duration, |
| 661 int overrides, | 676 int overrides, |
| 662 const PowerStateRequestIdCallback& callback) OVERRIDE {} | 677 const PowerStateRequestIdCallback& callback) OVERRIDE {} |
| 663 | 678 |
| 664 virtual void NotifyScreenLockRequested() OVERRIDE { | 679 virtual void NotifyScreenLockRequested() OVERRIDE { |
| 665 screen_locked_ = true; | 680 screen_locked_ = true; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 PowerManagerClient* PowerManagerClient::Create( | 748 PowerManagerClient* PowerManagerClient::Create( |
| 734 DBusClientImplementationType type, | 749 DBusClientImplementationType type, |
| 735 dbus::Bus* bus) { | 750 dbus::Bus* bus) { |
| 736 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 751 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
| 737 return new PowerManagerClientImpl(bus); | 752 return new PowerManagerClientImpl(bus); |
| 738 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); | 753 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); |
| 739 return new PowerManagerClientStubImpl(); | 754 return new PowerManagerClientStubImpl(); |
| 740 } | 755 } |
| 741 | 756 |
| 742 } // namespace chromeos | 757 } // namespace chromeos |
| OLD | NEW |