Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(581)

Unified Diff: chrome/browser/chromeos/cros/power_library.h

Issue 8271024: chromeos: Add power supply info reading capability (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebased after refactoring Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/cros/power_library.h
diff --git a/chrome/browser/chromeos/cros/power_library.h b/chrome/browser/chromeos/cros/power_library.h
index e6ef46d0935746bf0869be3a7bcb9ba4dca79077..20f30acfa59cf6a35f965ebe417206b6df76770b 100644
--- a/chrome/browser/chromeos/cros/power_library.h
+++ b/chrome/browser/chromeos/cros/power_library.h
@@ -9,6 +9,7 @@
// TODO(sque): Move to chrome/browser/chromeos/system, crosbug.com/16558
#include "base/callback.h"
+#include "chrome/browser/chromeos/dbus/power_manager_client.h"
namespace base {
class TimeDelta;
@@ -17,6 +18,7 @@ class TimeDelta;
namespace chromeos {
typedef base::Callback<void(int64_t)> CalculateIdleTimeCallback;
+struct PowerStatus;
struct PowerSupplyStatus {
bool line_power_on;
@@ -36,12 +38,14 @@ struct PowerSupplyStatus {
battery_seconds_to_empty(0),
battery_seconds_to_full(0),
battery_percentage(0) {}
+
+ const std::string& ToString() const;
};
// This interface defines interaction with the ChromeOS power library APIs.
// Classes can add themselves as observers. Users can get an instance of this
// library class like this: chromeos::CrosLibrary::Get()->GetPowerLibrary()
-class PowerLibrary {
+class PowerLibrary : public PowerManagerClient::Observer {
public:
class Observer {
public:
@@ -75,6 +79,10 @@ class PowerLibrary {
// UI initiated request for status update.
virtual void RequestStatusUpdate() = 0;
+ // Requests power supply info.
+ virtual void UpdatePowerStatus(const PowerStatus& status) = 0;
+
+
// Factory function, creates a new instance and returns ownership.
// For normal usage, access the singleton via CrosLibrary::Get().
static PowerLibrary* GetImpl(bool stub);

Powered by Google App Engine
This is Rietveld 408576698