Index: ash/system/power/power_supply_status.cc |
diff --git a/ash/system/power/power_supply_status.cc b/ash/system/power/power_supply_status.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d1ad5dc9a06f4147d24b503a4e36dafa15974a24 |
--- /dev/null |
+++ b/ash/system/power/power_supply_status.cc |
@@ -0,0 +1,44 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "ash/system/power/power_supply_status.h" |
+ |
+#include "base/format_macros.h" |
+#include "base/stringprintf.h" |
+ |
+namespace ash { |
+ |
+PowerSupplyStatus::PowerSupplyStatus() |
+ : line_power_on(false), |
+ battery_is_present(false), |
+ battery_is_full(false), |
+ battery_seconds_to_empty(0), |
+ battery_seconds_to_full(0), |
+ battery_percentage(0) { |
+} |
+ |
+std::string PowerSupplyStatus::ToString() const { |
+ std::string result; |
+ base::StringAppendF(&result, |
+ "line_power_on = %s ", |
+ line_power_on ? "true" : "false"); |
+ base::StringAppendF(&result, |
+ "battery_is_present = %s ", |
+ battery_is_present ? "true" : "false"); |
+ base::StringAppendF(&result, |
+ "battery_is_full = %s ", |
+ battery_is_full ? "true" : "false"); |
+ base::StringAppendF(&result, |
+ "battery_percentage = %f ", |
+ battery_percentage); |
+ base::StringAppendF(&result, |
+ "battery_seconds_to_empty = %"PRId64" ", |
+ battery_seconds_to_empty); |
+ base::StringAppendF(&result, |
+ "battery_seconds_to_full = %"PRId64" ", |
+ battery_seconds_to_full); |
+ return result; |
+} |
+ |
+} // namespace ash |