OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ash/system/power/power_supply_status.h" |
| 6 |
| 7 #include "base/format_macros.h" |
| 8 #include "base/stringprintf.h" |
| 9 |
| 10 namespace ash { |
| 11 |
| 12 PowerSupplyStatus::PowerSupplyStatus() |
| 13 : line_power_on(false), |
| 14 battery_is_present(false), |
| 15 battery_is_full(false), |
| 16 battery_seconds_to_empty(0), |
| 17 battery_seconds_to_full(0), |
| 18 battery_percentage(0) { |
| 19 } |
| 20 |
| 21 std::string PowerSupplyStatus::ToString() const { |
| 22 std::string result; |
| 23 base::StringAppendF(&result, |
| 24 "line_power_on = %s ", |
| 25 line_power_on ? "true" : "false"); |
| 26 base::StringAppendF(&result, |
| 27 "battery_is_present = %s ", |
| 28 battery_is_present ? "true" : "false"); |
| 29 base::StringAppendF(&result, |
| 30 "battery_is_full = %s ", |
| 31 battery_is_full ? "true" : "false"); |
| 32 base::StringAppendF(&result, |
| 33 "battery_percentage = %f ", |
| 34 battery_percentage); |
| 35 base::StringAppendF(&result, |
| 36 "battery_seconds_to_empty = %"PRId64" ", |
| 37 battery_seconds_to_empty); |
| 38 base::StringAppendF(&result, |
| 39 "battery_seconds_to_full = %"PRId64" ", |
| 40 battery_seconds_to_full); |
| 41 return result; |
| 42 } |
| 43 |
| 44 } // namespace ash |
OLD | NEW |