| 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_supply_status.h" | 5 #include "chromeos/dbus/power_supply_status.h" |
| 6 | 6 |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 | 9 |
| 10 namespace chromeos { | 10 namespace chromeos { |
| 11 | 11 |
| 12 PowerSupplyStatus::PowerSupplyStatus() | 12 PowerSupplyStatus::PowerSupplyStatus() |
| 13 : line_power_on(false), | 13 : line_power_on(false), |
| 14 battery_is_present(false), | 14 battery_is_present(false), |
| 15 battery_is_full(false), | 15 battery_is_full(false), |
| 16 battery_seconds_to_empty(0), | 16 battery_seconds_to_empty(0), |
| 17 battery_seconds_to_full(0), | 17 battery_seconds_to_full(0), |
| 18 averaged_battery_time_to_empty(0), |
| 19 averaged_battery_time_to_full(0), |
| 18 battery_percentage(0), | 20 battery_percentage(0), |
| 19 is_calculating_battery_time(false) {} | 21 is_calculating_battery_time(false) {} |
| 20 | 22 |
| 21 std::string PowerSupplyStatus::ToString() const { | 23 std::string PowerSupplyStatus::ToString() const { |
| 22 std::string result; | 24 std::string result; |
| 23 base::StringAppendF(&result, | 25 base::StringAppendF(&result, |
| 24 "line_power_on = %s ", | 26 "line_power_on = %s ", |
| 25 line_power_on ? "true" : "false"); | 27 line_power_on ? "true" : "false"); |
| 26 base::StringAppendF(&result, | 28 base::StringAppendF(&result, |
| 27 "battery_is_present = %s ", | 29 "battery_is_present = %s ", |
| 28 battery_is_present ? "true" : "false"); | 30 battery_is_present ? "true" : "false"); |
| 29 base::StringAppendF(&result, | 31 base::StringAppendF(&result, |
| 30 "battery_is_full = %s ", | 32 "battery_is_full = %s ", |
| 31 battery_is_full ? "true" : "false"); | 33 battery_is_full ? "true" : "false"); |
| 32 base::StringAppendF(&result, | 34 base::StringAppendF(&result, |
| 33 "battery_percentage = %f ", | 35 "battery_percentage = %f ", |
| 34 battery_percentage); | 36 battery_percentage); |
| 35 base::StringAppendF(&result, | 37 base::StringAppendF(&result, |
| 36 "battery_seconds_to_empty = %"PRId64" ", | 38 "battery_seconds_to_empty = %"PRId64" ", |
| 37 battery_seconds_to_empty); | 39 battery_seconds_to_empty); |
| 38 base::StringAppendF(&result, | 40 base::StringAppendF(&result, |
| 39 "battery_seconds_to_full = %"PRId64" ", | 41 "battery_seconds_to_full = %"PRId64" ", |
| 40 battery_seconds_to_full); | 42 battery_seconds_to_full); |
| 41 base::StringAppendF(&result, | 43 base::StringAppendF(&result, |
| 44 "averaged_battery_time_to_empty = %"PRId64" ", |
| 45 averaged_battery_time_to_empty); |
| 46 base::StringAppendF(&result, |
| 47 "averaged_battery_time_to_full = %"PRId64" ", |
| 48 averaged_battery_time_to_full); |
| 49 base::StringAppendF(&result, |
| 42 "is_calculating_battery_time = %s ", | 50 "is_calculating_battery_time = %s ", |
| 43 is_calculating_battery_time ? "true" : "false"); | 51 is_calculating_battery_time ? "true" : "false"); |
| 44 | 52 |
| 45 return result; | 53 return result; |
| 46 } | 54 } |
| 47 | 55 |
| 48 } // namespace chromeos | 56 } // namespace chromeos |
| OLD | NEW |