summaryrefslogtreecommitdiffstats
path: root/chromeos/dbus/power_manager_client.cc
diff options
context:
space:
mode:
authorrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-01 21:31:07 +0000
committerrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-01 21:31:07 +0000
commit3f4181a35b24d814f498362c98eab0e161154427 (patch)
tree511fb698b3746f2fb322f6c0580eb82aafe17fbe /chromeos/dbus/power_manager_client.cc
parent143094e5a5f6c524ef57a0201906c988ecbc88ba (diff)
downloadchromium_src-3f4181a35b24d814f498362c98eab0e161154427.zip
chromium_src-3f4181a35b24d814f498362c98eab0e161154427.tar.gz
chromium_src-3f4181a35b24d814f498362c98eab0e161154427.tar.bz2
Screensaver implementation for ChromeOS.
This is the initial implementation for screensaver extensions. The feature is currently behind a flag and installing an extension with a screensaver permission without the flag enabled will do nothing. This currently allows one Screensaver extension to be installed at a time, and brings up the screensaver after a fixed 2 minutes. Further work to be done is to add different timeouts for power manager if the screensaver is active, add more tests and add security features for the screensaver permission (if needed, this needs to be discussed still). TBR'ed jhawkins for chrome_browser_chromeos.gypi R=mpcomplete@chromium.org,stevenjb@chromium.org BUG=163681 TBR=jhawkins@chromium.org Review URL: https://codereview.chromium.org/12093058 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180189 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/dbus/power_manager_client.cc')
-rw-r--r--chromeos/dbus/power_manager_client.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/chromeos/dbus/power_manager_client.cc b/chromeos/dbus/power_manager_client.cc
index 8b0adb8..f3df801 100644
--- a/chromeos/dbus/power_manager_client.cc
+++ b/chromeos/dbus/power_manager_client.cc
@@ -10,6 +10,7 @@
#include "base/callback.h"
#include "base/format_macros.h"
#include "base/memory/scoped_ptr.h"
+#include "base/message_loop.h"
#include "base/observer_list.h"
#include "base/stringprintf.h"
#include "base/threading/platform_thread.h"
@@ -806,7 +807,15 @@ class PowerManagerClientStubImpl : public PowerManagerClient {
callback.Run(0);
}
- virtual void RequestIdleNotification(int64 threshold) OVERRIDE {}
+ virtual void RequestIdleNotification(int64 threshold) OVERRIDE {
+ MessageLoop::current()->PostDelayedTask(
+ FROM_HERE,
+ base::Bind(&PowerManagerClientStubImpl::TriggerIdleNotify,
+ base::Unretained(this),
+ threshold),
+ base::TimeDelta::FromMilliseconds(threshold));
+ }
+
virtual void NotifyUserActivity(
const base::TimeTicks& last_activity_time) OVERRIDE {}
virtual void NotifyVideoActivity(
@@ -869,6 +878,10 @@ class PowerManagerClientStubImpl : public PowerManagerClient {
BrightnessChanged(brightness_level, user_initiated));
}
+ void TriggerIdleNotify(int64 threshold) {
+ FOR_EACH_OBSERVER(Observer, observers_, IdleNotify(threshold));
+ }
+
bool discharging_;
int battery_percentage_;
double brightness_;