diff options
author | rkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-01 21:31:07 +0000 |
---|---|---|
committer | rkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-01 21:31:07 +0000 |
commit | 3f4181a35b24d814f498362c98eab0e161154427 (patch) | |
tree | 511fb698b3746f2fb322f6c0580eb82aafe17fbe /chromeos | |
parent | 143094e5a5f6c524ef57a0201906c988ecbc88ba (diff) | |
download | chromium_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')
-rw-r--r-- | chromeos/chromeos_switches.cc | 3 | ||||
-rw-r--r-- | chromeos/chromeos_switches.h | 1 | ||||
-rw-r--r-- | chromeos/dbus/power_manager_client.cc | 15 |
3 files changed, 18 insertions, 1 deletions
diff --git a/chromeos/chromeos_switches.cc b/chromeos/chromeos_switches.cc index 69f1c5f..b8769de 100644 --- a/chromeos/chromeos_switches.cc +++ b/chromeos/chromeos_switches.cc @@ -16,6 +16,9 @@ const char kDbusStub[] = "dbus-stub"; // Enables the new NetworkStateHandler class. const char kEnableNewNetworkHandlers[] = "enable-new-network-handlers"; +// Enables screensaver extensions. +const char kEnableScreensaverExtensions[] = "enable-screensaver-extensions"; + // Sends test messages on first call to RequestUpdate (stub only). const char kSmsTestMessages[] = "sms-test-messages"; diff --git a/chromeos/chromeos_switches.h b/chromeos/chromeos_switches.h index 565121d..9cee7a3 100644 --- a/chromeos/chromeos_switches.h +++ b/chromeos/chromeos_switches.h @@ -23,6 +23,7 @@ namespace switches { CHROMEOS_EXPORT extern const char kChromeOSReleaseBoard[]; CHROMEOS_EXPORT extern const char kDbusStub[]; CHROMEOS_EXPORT extern const char kEnableNewNetworkHandlers[]; +CHROMEOS_EXPORT extern const char kEnableScreensaverExtensions[]; CHROMEOS_EXPORT extern const char kSmsTestMessages[]; } // namespace switches 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_; |