summaryrefslogtreecommitdiffstats
path: root/chromeos
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
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')
-rw-r--r--chromeos/chromeos.gyp23
-rw-r--r--chromeos/chromeos_export.h26
-rw-r--r--chromeos/dbus/power_supply_status.cc44
-rw-r--r--chromeos/dbus/power_supply_status.h33
4 files changed, 126 insertions, 0 deletions
diff --git a/chromeos/chromeos.gyp b/chromeos/chromeos.gyp
new file mode 100644
index 0000000..bf6bd00
--- /dev/null
+++ b/chromeos/chromeos.gyp
@@ -0,0 +1,23 @@
+# 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.
+
+{
+ 'variables': {
+ 'chromium_code': 1,
+ },
+ 'targets': [
+ {
+ 'target_name': 'chromeos',
+ 'type': '<(component)',
+ 'dependencies': [
+ '../base/base.gyp:base',
+ ],
+ 'sources': [
+ 'chromeos_export.h',
+ 'dbus/power_supply_status.cc',
+ 'dbus/power_supply_status.h',
+ ],
+ },
+ ]
+}
diff --git a/chromeos/chromeos_export.h b/chromeos/chromeos_export.h
new file mode 100644
index 0000000..7be813f
--- /dev/null
+++ b/chromeos/chromeos_export.h
@@ -0,0 +1,26 @@
+// 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.
+
+#ifndef CHROMEOS_CHROMEOS_EXPORT_H_
+#define CHROMEOS_CHROMEOS_EXPORT_H_
+#pragma once
+
+#if defined(COMPONENT_BUILD)
+#if defined(WIN32)
+
+#if defined(CHROMEOS_IMPLEMENTATION)
+#define CHROMEOS_EXPORT __declspec(dllexport)
+#else
+#define CHROMEOS_EXPORT __declspec(dllimport)
+#endif // defined(CHROMEOS_IMPLEMENTATION)
+
+#else // defined(WIN32)
+#define CHROMEOS_EXPORT __attribute__((visibility("default")))
+#endif
+
+#else // defined(COMPONENT_BUILD)
+#define CHROMEOS_EXPORT
+#endif
+
+#endif // CHROMEOS_CHROMEOS_EXPORT_H_
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
diff --git a/chromeos/dbus/power_supply_status.h b/chromeos/dbus/power_supply_status.h
new file mode 100644
index 0000000..8e435d7
--- /dev/null
+++ b/chromeos/dbus/power_supply_status.h
@@ -0,0 +1,33 @@
+// 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.
+
+#ifndef CHROMEOS_DBUS_POWER_SUPPLY_STATUS_H_
+#define CHROMEOS_DBUS_POWER_SUPPLY_STATUS_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "chromeos/chromeos_export.h"
+
+namespace chromeos {
+
+struct CHROMEOS_EXPORT PowerSupplyStatus {
+ bool line_power_on;
+
+ bool battery_is_present;
+ bool battery_is_full;
+
+ // Time in seconds until the battery is empty or full, 0 for unknown.
+ int64 battery_seconds_to_empty;
+ int64 battery_seconds_to_full;
+
+ double battery_percentage;
+
+ PowerSupplyStatus();
+ std::string ToString() const;
+};
+
+} // namespace chromeos
+
+#endif // CHROMEOS_DBUS_POWER_SUPPLY_STATUS_H_