| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 dbus::MethodCall method_call( | 141 dbus::MethodCall method_call( |
| 142 power_manager::kPowerManagerInterface, | 142 power_manager::kPowerManagerInterface, |
| 143 power_manager::kGetPowerSupplyPropertiesMethod); | 143 power_manager::kGetPowerSupplyPropertiesMethod); |
| 144 power_manager_proxy_->CallMethod( | 144 power_manager_proxy_->CallMethod( |
| 145 &method_call, | 145 &method_call, |
| 146 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 146 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 147 base::Bind(&PowerManagerClientImpl::OnGetPowerSupplyPropertiesMethod, | 147 base::Bind(&PowerManagerClientImpl::OnGetPowerSupplyPropertiesMethod, |
| 148 weak_ptr_factory_.GetWeakPtr())); | 148 weak_ptr_factory_.GetWeakPtr())); |
| 149 } | 149 } |
| 150 | 150 |
| 151 virtual void RequestSuspend() OVERRIDE { |
| 152 SimpleMethodCallToPowerManager(power_manager::kRequestSuspendMethod); |
| 153 } |
| 154 |
| 151 virtual void RequestRestart() OVERRIDE { | 155 virtual void RequestRestart() OVERRIDE { |
| 152 SimpleMethodCallToPowerManager(power_manager::kRequestRestartMethod); | 156 SimpleMethodCallToPowerManager(power_manager::kRequestRestartMethod); |
| 153 }; | 157 } |
| 154 | 158 |
| 155 virtual void RequestShutdown() OVERRIDE { | 159 virtual void RequestShutdown() OVERRIDE { |
| 156 SimpleMethodCallToPowerManager(power_manager::kRequestShutdownMethod); | 160 SimpleMethodCallToPowerManager(power_manager::kRequestShutdownMethod); |
| 157 } | 161 } |
| 158 | 162 |
| 159 virtual void NotifyUserActivity( | 163 virtual void NotifyUserActivity( |
| 160 power_manager::UserActivityType type) OVERRIDE { | 164 power_manager::UserActivityType type) OVERRIDE { |
| 161 dbus::MethodCall method_call( | 165 dbus::MethodCall method_call( |
| 162 power_manager::kPowerManagerInterface, | 166 power_manager::kPowerManagerInterface, |
| 163 power_manager::kHandleUserActivityMethod); | 167 power_manager::kHandleUserActivityMethod); |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 virtual void IncreaseKeyboardBrightness() OVERRIDE { | 802 virtual void IncreaseKeyboardBrightness() OVERRIDE { |
| 799 VLOG(1) << "Requested to increase keyboard brightness"; | 803 VLOG(1) << "Requested to increase keyboard brightness"; |
| 800 } | 804 } |
| 801 | 805 |
| 802 virtual void RequestStatusUpdate() OVERRIDE { | 806 virtual void RequestStatusUpdate() OVERRIDE { |
| 803 base::MessageLoop::current()->PostTask(FROM_HERE, | 807 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 804 base::Bind(&PowerManagerClientStubImpl::UpdateStatus, | 808 base::Bind(&PowerManagerClientStubImpl::UpdateStatus, |
| 805 weak_ptr_factory_.GetWeakPtr())); | 809 weak_ptr_factory_.GetWeakPtr())); |
| 806 } | 810 } |
| 807 | 811 |
| 812 virtual void RequestSuspend() OVERRIDE {} |
| 808 virtual void RequestRestart() OVERRIDE {} | 813 virtual void RequestRestart() OVERRIDE {} |
| 809 virtual void RequestShutdown() OVERRIDE {} | 814 virtual void RequestShutdown() OVERRIDE {} |
| 810 | 815 |
| 811 virtual void NotifyUserActivity( | 816 virtual void NotifyUserActivity( |
| 812 power_manager::UserActivityType type) OVERRIDE {} | 817 power_manager::UserActivityType type) OVERRIDE {} |
| 813 virtual void NotifyVideoActivity(bool is_fullscreen) OVERRIDE {} | 818 virtual void NotifyVideoActivity(bool is_fullscreen) OVERRIDE {} |
| 814 virtual void SetPolicy( | 819 virtual void SetPolicy( |
| 815 const power_manager::PowerManagementPolicy& policy) OVERRIDE {} | 820 const power_manager::PowerManagementPolicy& policy) OVERRIDE {} |
| 816 virtual void SetIsProjecting(bool is_projecting) OVERRIDE {} | 821 virtual void SetIsProjecting(bool is_projecting) OVERRIDE {} |
| 817 virtual base::Closure GetSuspendReadinessCallback() OVERRIDE { | 822 virtual base::Closure GetSuspendReadinessCallback() OVERRIDE { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 // static | 959 // static |
| 955 PowerManagerClient* PowerManagerClient::Create( | 960 PowerManagerClient* PowerManagerClient::Create( |
| 956 DBusClientImplementationType type) { | 961 DBusClientImplementationType type) { |
| 957 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 962 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
| 958 return new PowerManagerClientImpl(); | 963 return new PowerManagerClientImpl(); |
| 959 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); | 964 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); |
| 960 return new PowerManagerClientStubImpl(); | 965 return new PowerManagerClientStubImpl(); |
| 961 } | 966 } |
| 962 | 967 |
| 963 } // namespace chromeos | 968 } // namespace chromeos |
| OLD | NEW |