summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--ash/ash.gyp5
-rw-r--r--ash/system/power/power_status_observer.h4
-rw-r--r--ash/system/power/power_supply_status.cc2
-rw-r--r--ash/system/power/power_supply_status.h9
-rw-r--r--ash/system/tray/system_tray_delegate.h3
-rw-r--r--chrome/browser/chromeos/dbus/power_manager_client.cc34
-rw-r--r--chrome/browser/chromeos/dbus/power_manager_client.h25
-rw-r--r--chrome/chrome_browser.gypi1
-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
12 files changed, 147 insertions, 62 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp
index edc0b13..c27dcb9 100644
--- a/ash/ash.gyp
+++ b/ash/ash.gyp
@@ -299,6 +299,11 @@
['exclude', 'accelerators/nested_dispatcher_controller.h'],
],
}],
+ ['chromeos==1', {
+ 'dependencies': [
+ '../chromeos/chromeos.gyp:chromeos',
+ ],
+ }],
],
},
{
diff --git a/ash/system/power/power_status_observer.h b/ash/system/power/power_status_observer.h
index 725d388..3a4b1b4 100644
--- a/ash/system/power/power_status_observer.h
+++ b/ash/system/power/power_status_observer.h
@@ -5,9 +5,9 @@
#ifndef ASH_SYSTEM_POWER_POWER_STATUS_OBSERVER_H_
#define ASH_SYSTEM_POWER_POWER_STATUS_OBSERVER_H_
-namespace ash {
+#include "ash/system/power/power_supply_status.h"
-struct PowerSupplyStatus;
+namespace ash {
class PowerStatusObserver {
public:
diff --git a/ash/system/power/power_supply_status.cc b/ash/system/power/power_supply_status.cc
index d1ad5dc..79cfa86 100644
--- a/ash/system/power/power_supply_status.cc
+++ b/ash/system/power/power_supply_status.cc
@@ -9,6 +9,7 @@
namespace ash {
+#if !defined(OS_CHROMEOS)
PowerSupplyStatus::PowerSupplyStatus()
: line_power_on(false),
battery_is_present(false),
@@ -40,5 +41,6 @@ std::string PowerSupplyStatus::ToString() const {
battery_seconds_to_full);
return result;
}
+#endif // !defined(OS_CHROMEOS)
} // namespace ash
diff --git a/ash/system/power/power_supply_status.h b/ash/system/power/power_supply_status.h
index c70101b..03d70a5 100644
--- a/ash/system/power/power_supply_status.h
+++ b/ash/system/power/power_supply_status.h
@@ -10,8 +10,16 @@
#include "ash/ash_export.h"
#include "base/basictypes.h"
+#if defined(OS_CHROMEOS)
+#include "chromeos/dbus/power_supply_status.h"
+#endif
+
namespace ash {
+#if defined(OS_CHROMEOS)
+typedef chromeos::PowerSupplyStatus PowerSupplyStatus;
+#else
+// Define local struct when not building for Chrome OS.
struct ASH_EXPORT PowerSupplyStatus {
bool line_power_on;
@@ -27,6 +35,7 @@ struct ASH_EXPORT PowerSupplyStatus {
PowerSupplyStatus();
std::string ToString() const;
};
+#endif // defined(OS_CHROMEOS)
} // namespace ash
diff --git a/ash/system/tray/system_tray_delegate.h b/ash/system/tray/system_tray_delegate.h
index 9e7eb0f..420fd2da 100644
--- a/ash/system/tray/system_tray_delegate.h
+++ b/ash/system/tray/system_tray_delegate.h
@@ -11,6 +11,7 @@
#include "ash/ash_export.h"
#include "ash/system/user/login_status.h"
+#include "ash/system/power/power_supply_status.h"
#include "base/i18n/time_formatting.h"
#include "base/string16.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -65,8 +66,6 @@ struct ASH_EXPORT IMEInfo {
typedef std::vector<IMEInfo> IMEInfoList;
-struct PowerSupplyStatus;
-
class SystemTrayDelegate {
public:
virtual ~SystemTrayDelegate() {}
diff --git a/chrome/browser/chromeos/dbus/power_manager_client.cc b/chrome/browser/chromeos/dbus/power_manager_client.cc
index 8899b39..d089e9d 100644
--- a/chrome/browser/chromeos/dbus/power_manager_client.cc
+++ b/chrome/browser/chromeos/dbus/power_manager_client.cc
@@ -24,40 +24,6 @@
namespace chromeos {
-#if !defined(USE_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;
-}
-#endif // !defined(USE_ASH)
-
// The PowerManagerClient implementation used in production.
class PowerManagerClientImpl : public PowerManagerClient {
public:
diff --git a/chrome/browser/chromeos/dbus/power_manager_client.h b/chrome/browser/chromeos/dbus/power_manager_client.h
index 0dd32d7..0c7c3b1 100644
--- a/chrome/browser/chromeos/dbus/power_manager_client.h
+++ b/chrome/browser/chromeos/dbus/power_manager_client.h
@@ -11,9 +11,7 @@
#include "base/callback.h"
#include "chrome/browser/chromeos/dbus/dbus_client_implementation_type.h"
-#if defined(USE_ASH)
-#include "ash/system/power/power_supply_status.h"
-#endif
+#include "chromeos/dbus/power_supply_status.h"
namespace base {
class TimeTicks;
@@ -24,27 +22,6 @@ class Bus;
namespace chromeos {
-#if defined(USE_ASH)
-typedef struct ash::PowerSupplyStatus PowerSupplyStatus;
-#else
-// This is the local struct that is used in Chrome.
-struct 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;
-};
-#endif
-
// Callback used for processing the idle time. The int64 param is the number of
// seconds the user has been idle.
typedef base::Callback<void(int64)> CalculateIdleTimeCallback;
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 23de458..9e1eeee 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -4202,6 +4202,7 @@
],
'dependencies': [
'../build/linux/system.gyp:dbus-glib',
+ '../chromeos/chromeos.gyp:chromeos',
'../third_party/libevent/libevent.gyp:libevent',
'../third_party/mozc/chrome/chromeos/renderer/chromeos_renderer.gyp:mozc_candidates_proto',
'browser/chromeos/input_method/input_method.gyp:gencode',
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_