summaryrefslogtreecommitdiffstats
path: root/chromeos/dbus/power_supply_status.cc
diff options
context:
space:
mode:
authorhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-05 00:50:27 +0000
committerhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-05 00:50:27 +0000
commitaf4ac5de80eafa5a21975d5392525c6cf356b4e6 (patch)
treeae2611f28833ab44c277f6c3294249d738c5e4f1 /chromeos/dbus/power_supply_status.cc
parent162f58f999477e60cb70fcc00bfe80e120ca4876 (diff)
downloadchromium_src-af4ac5de80eafa5a21975d5392525c6cf356b4e6.zip
chromium_src-af4ac5de80eafa5a21975d5392525c6cf356b4e6.tar.gz
chromium_src-af4ac5de80eafa5a21975d5392525c6cf356b4e6.tar.bz2
Copy ash/system/power/power_supply_status.* to src/chromeos
Copy power_supply_status.* Move #ifdef trick from power_manager_client.h to power_supply_status.h Add chromeos.gyp Add dependency from ash to chromeos when chromeos==1 BUG=119583 TEST=build success, checkdeps success Review URL: https://chromiumcodereview.appspot.com/9837075 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130796 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/dbus/power_supply_status.cc')
-rw-r--r--chromeos/dbus/power_supply_status.cc44
1 files changed, 44 insertions, 0 deletions
diff --git a/chromeos/dbus/power_supply_status.cc b/chromeos/dbus/power_supply_status.cc
new file mode 100644
index 0000000..cc0d9f2
--- /dev/null
+++ b/chromeos/dbus/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 "chromeos/dbus/power_supply_status.h"
+
+#include "base/format_macros.h"
+#include "base/stringprintf.h"
+
+namespace chromeos {
+
+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 chromeos