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

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

Issue 7920019: Add PowerLibrary::RequestStatusUpdate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove deprecated libcros call. Created 9 years, 3 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
« no previous file with comments | « chrome/browser/chromeos/cros/power_library.h ('k') | chrome/browser/chromeos/status/power_menu_button.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/cros/power_library.cc
diff --git a/chrome/browser/chromeos/cros/power_library.cc b/chrome/browser/chromeos/cros/power_library.cc
index dbedff9286f14b6ab54f04a70cbce470124a69d9..b4e0d9fd61f4338a97776a224176e32dfe611735 100644
--- a/chrome/browser/chromeos/cros/power_library.cc
+++ b/chrome/browser/chromeos/cros/power_library.cc
@@ -109,6 +109,13 @@ class PowerLibraryImpl : public PowerLibrary {
if (CrosLibrary::Get()->EnsureLoaded())
chromeos::RequestShutdown();
}
+
+ virtual void RequestStatusUpdate() OVERRIDE {
+ // TODO(stevenjb): chromeos::RetrievePowerInformation has been deprecated;
+ // we should add a mechanism to immediately request an update, probably
+ // when we migrate the DBus code from libcros to here.
+ }
+
// End PowerLibrary implementation.
private:
@@ -190,13 +197,8 @@ class PowerLibraryStubImpl : public PowerLibrary {
public:
PowerLibraryStubImpl()
: discharging_(true),
- battery_percentage_(20),
+ battery_percentage_(80),
pause_count_(0) {
- timer_.Start(
- FROM_HERE,
- base::TimeDelta::FromMilliseconds(100),
- this,
- &PowerLibraryStubImpl::Update);
}
virtual ~PowerLibraryStubImpl() {}
@@ -245,9 +247,25 @@ class PowerLibraryStubImpl : public PowerLibrary {
callback->Run(0);
delete callback;
}
+
virtual void EnableScreenLock(bool enable) OVERRIDE {}
+
virtual void RequestRestart() OVERRIDE {}
+
virtual void RequestShutdown() OVERRIDE {}
+
+ virtual void RequestStatusUpdate() OVERRIDE {
+ if (!timer_.IsRunning()) {
+ timer_.Start(
+ FROM_HERE,
+ base::TimeDelta::FromMilliseconds(100),
+ this,
+ &PowerLibraryStubImpl::Update);
+ } else {
+ timer_.Stop();
+ }
+ }
+
// End PowerLibrary implementation.
private:
« no previous file with comments | « chrome/browser/chromeos/cros/power_library.h ('k') | chrome/browser/chromeos/status/power_menu_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698