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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 } | 217 } |
218 | 218 |
219 virtual void RequestActiveNotification() OVERRIDE { | 219 virtual void RequestActiveNotification() OVERRIDE { |
220 RequestIdleNotification(0); | 220 RequestIdleNotification(0); |
221 } | 221 } |
222 | 222 |
223 virtual void RequestPowerStateOverrides( | 223 virtual void RequestPowerStateOverrides( |
224 uint32 request_id, | 224 uint32 request_id, |
225 uint32 duration, | 225 uint32 duration, |
226 int overrides, | 226 int overrides, |
227 PowerStateRequestIdCallback callback) OVERRIDE { | 227 const PowerStateRequestIdCallback& callback) OVERRIDE { |
228 dbus::MethodCall method_call(power_manager::kPowerManagerInterface, | 228 dbus::MethodCall method_call(power_manager::kPowerManagerInterface, |
229 power_manager::kStateOverrideRequest); | 229 power_manager::kStateOverrideRequest); |
230 dbus::MessageWriter writer(&method_call); | 230 dbus::MessageWriter writer(&method_call); |
231 | 231 |
232 PowerStateControl protobuf; | 232 PowerStateControl protobuf; |
233 protobuf.set_request_id(request_id); | 233 protobuf.set_request_id(request_id); |
234 protobuf.set_duration(duration); | 234 protobuf.set_duration(duration); |
235 protobuf.set_disable_idle_dim(overrides & DISABLE_IDLE_DIM); | 235 protobuf.set_disable_idle_dim(overrides & DISABLE_IDLE_DIM); |
236 protobuf.set_disable_idle_blank(overrides & DISABLE_IDLE_BLANK); | 236 protobuf.set_disable_idle_blank(overrides & DISABLE_IDLE_BLANK); |
237 protobuf.set_disable_idle_suspend(overrides & DISABLE_IDLE_SUSPEND); | 237 protobuf.set_disable_idle_suspend(overrides & DISABLE_IDLE_SUSPEND); |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 OVERRIDE { | 537 OVERRIDE { |
538 callback.Run(0); | 538 callback.Run(0); |
539 } | 539 } |
540 | 540 |
541 virtual void RequestIdleNotification(int64 threshold) OVERRIDE {} | 541 virtual void RequestIdleNotification(int64 threshold) OVERRIDE {} |
542 virtual void RequestActiveNotification() OVERRIDE {} | 542 virtual void RequestActiveNotification() OVERRIDE {} |
543 virtual void RequestPowerStateOverrides( | 543 virtual void RequestPowerStateOverrides( |
544 uint32 request_id, | 544 uint32 request_id, |
545 uint32 duration, | 545 uint32 duration, |
546 int overrides, | 546 int overrides, |
547 PowerStateRequestIdCallback callback) OVERRIDE {} | 547 const PowerStateRequestIdCallback& callback) OVERRIDE {} |
548 | 548 |
549 virtual void NotifyScreenLockRequested() OVERRIDE { | 549 virtual void NotifyScreenLockRequested() OVERRIDE { |
550 FOR_EACH_OBSERVER(Observer, observers_, LockScreen()); | 550 FOR_EACH_OBSERVER(Observer, observers_, LockScreen()); |
551 } | 551 } |
552 virtual void NotifyScreenLockCompleted() OVERRIDE {} | 552 virtual void NotifyScreenLockCompleted() OVERRIDE {} |
553 virtual void NotifyScreenUnlockRequested() OVERRIDE { | 553 virtual void NotifyScreenUnlockRequested() OVERRIDE { |
554 FOR_EACH_OBSERVER(Observer, observers_, UnlockScreen()); | 554 FOR_EACH_OBSERVER(Observer, observers_, UnlockScreen()); |
555 } | 555 } |
556 | 556 |
557 virtual void NotifyScreenUnlockCompleted() OVERRIDE {} | 557 virtual void NotifyScreenUnlockCompleted() OVERRIDE {} |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 PowerManagerClient* PowerManagerClient::Create( | 608 PowerManagerClient* PowerManagerClient::Create( |
609 DBusClientImplementationType type, | 609 DBusClientImplementationType type, |
610 dbus::Bus* bus) { | 610 dbus::Bus* bus) { |
611 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 611 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
612 return new PowerManagerClientImpl(bus); | 612 return new PowerManagerClientImpl(bus); |
613 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); | 613 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); |
614 return new PowerManagerClientStubImpl(); | 614 return new PowerManagerClientStubImpl(); |
615 } | 615 } |
616 | 616 |
617 } // namespace chromeos | 617 } // namespace chromeos |
OLD | NEW |