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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 } | 346 } |
347 | 347 |
348 dbus::MessageReader reader(response); | 348 dbus::MessageReader reader(response); |
349 PowerSupplyProperties protobuf; | 349 PowerSupplyProperties protobuf; |
350 reader.PopArrayOfBytesAsProto(&protobuf); | 350 reader.PopArrayOfBytesAsProto(&protobuf); |
351 | 351 |
352 PowerSupplyStatus status; | 352 PowerSupplyStatus status; |
353 status.line_power_on = protobuf.line_power_on(); | 353 status.line_power_on = protobuf.line_power_on(); |
354 status.battery_seconds_to_empty = protobuf.battery_time_to_empty(); | 354 status.battery_seconds_to_empty = protobuf.battery_time_to_empty(); |
355 status.battery_seconds_to_full = protobuf.battery_time_to_full(); | 355 status.battery_seconds_to_full = protobuf.battery_time_to_full(); |
| 356 status.averaged_battery_time_to_empty = |
| 357 protobuf.averaged_battery_time_to_empty(); |
| 358 status.averaged_battery_time_to_full = |
| 359 protobuf.averaged_battery_time_to_full(); |
356 status.battery_percentage = protobuf.battery_percentage(); | 360 status.battery_percentage = protobuf.battery_percentage(); |
357 status.battery_is_present = protobuf.battery_is_present(); | 361 status.battery_is_present = protobuf.battery_is_present(); |
358 status.battery_is_full = protobuf.battery_is_charged(); | 362 status.battery_is_full = protobuf.battery_is_charged(); |
359 status.is_calculating_battery_time = protobuf.is_calculating_battery_time(); | 363 status.is_calculating_battery_time = protobuf.is_calculating_battery_time(); |
360 | 364 |
361 VLOG(1) << "Power status: " << status.ToString(); | 365 VLOG(1) << "Power status: " << status.ToString(); |
362 FOR_EACH_OBSERVER(Observer, observers_, PowerChanged(status)); | 366 FOR_EACH_OBSERVER(Observer, observers_, PowerChanged(status)); |
363 } | 367 } |
364 | 368 |
365 void OnGetIdleTime(const CalculateIdleTimeCallback& callback, | 369 void OnGetIdleTime(const CalculateIdleTimeCallback& callback, |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 PowerManagerClient* PowerManagerClient::Create( | 612 PowerManagerClient* PowerManagerClient::Create( |
609 DBusClientImplementationType type, | 613 DBusClientImplementationType type, |
610 dbus::Bus* bus) { | 614 dbus::Bus* bus) { |
611 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 615 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
612 return new PowerManagerClientImpl(bus); | 616 return new PowerManagerClientImpl(bus); |
613 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); | 617 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); |
614 return new PowerManagerClientStubImpl(); | 618 return new PowerManagerClientStubImpl(); |
615 } | 619 } |
616 | 620 |
617 } // namespace chromeos | 621 } // namespace chromeos |
OLD | NEW |