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