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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 dbus::MethodCall method_call(power_manager::kPowerManagerInterface, | 308 dbus::MethodCall method_call(power_manager::kPowerManagerInterface, |
309 power_manager::kStateOverrideRequest); | 309 power_manager::kStateOverrideRequest); |
310 dbus::MessageWriter writer(&method_call); | 310 dbus::MessageWriter writer(&method_call); |
311 | 311 |
312 PowerStateControl protobuf; | 312 PowerStateControl protobuf; |
313 protobuf.set_request_id(request_id); | 313 protobuf.set_request_id(request_id); |
314 protobuf.set_duration(duration.InSeconds()); | 314 protobuf.set_duration(duration.InSeconds()); |
315 protobuf.set_disable_idle_dim(overrides & DISABLE_IDLE_DIM); | 315 protobuf.set_disable_idle_dim(overrides & DISABLE_IDLE_DIM); |
316 protobuf.set_disable_idle_blank(overrides & DISABLE_IDLE_BLANK); | 316 protobuf.set_disable_idle_blank(overrides & DISABLE_IDLE_BLANK); |
317 protobuf.set_disable_idle_suspend(overrides & DISABLE_IDLE_SUSPEND); | 317 protobuf.set_disable_idle_suspend(overrides & DISABLE_IDLE_SUSPEND); |
318 protobuf.set_disable_lid_suspend(overrides & DISABLE_IDLE_LID_SUSPEND); | 318 protobuf.set_disable_lid_suspend(overrides & DISABLE_LID_SUSPEND); |
319 | 319 |
320 if (!writer.AppendProtoAsArrayOfBytes(protobuf)) { | 320 if (!writer.AppendProtoAsArrayOfBytes(protobuf)) { |
321 LOG(ERROR) << "Error calling " | 321 LOG(ERROR) << "Error calling " |
322 << power_manager::kStateOverrideRequest; | 322 << power_manager::kStateOverrideRequest; |
323 return; | 323 return; |
324 } | 324 } |
325 power_manager_proxy_->CallMethod( | 325 power_manager_proxy_->CallMethod( |
326 &method_call, | 326 &method_call, |
327 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 327 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
328 base::Bind(&PowerManagerClientImpl::OnPowerStateOverride, | 328 base::Bind(&PowerManagerClientImpl::OnPowerStateOverride, |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
944 PowerManagerClient* PowerManagerClient::Create( | 944 PowerManagerClient* PowerManagerClient::Create( |
945 DBusClientImplementationType type, | 945 DBusClientImplementationType type, |
946 dbus::Bus* bus) { | 946 dbus::Bus* bus) { |
947 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 947 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
948 return new PowerManagerClientImpl(bus); | 948 return new PowerManagerClientImpl(bus); |
949 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); | 949 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); |
950 return new PowerManagerClientStubImpl(); | 950 return new PowerManagerClientStubImpl(); |
951 } | 951 } |
952 | 952 |
953 } // namespace chromeos | 953 } // namespace chromeos |
OLD | NEW |