summaryrefslogtreecommitdiffstats
path: root/ash/wm/user_activity_detector.cc
diff options
context:
space:
mode:
authorrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-23 00:51:52 +0000
committerrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-23 00:51:52 +0000
commit5bcf62d7a637eac921984b07a4d2e91f2ab5894c (patch)
tree2fddbeae5c27c7eccffdaf94448dc6105b06edd2 /ash/wm/user_activity_detector.cc
parentf308ae4264d35a1e9a8e974cbcc41a88f200d2ab (diff)
downloadchromium_src-5bcf62d7a637eac921984b07a4d2e91f2ab5894c.zip
chromium_src-5bcf62d7a637eac921984b07a4d2e91f2ab5894c.tar.gz
chromium_src-5bcf62d7a637eac921984b07a4d2e91f2ab5894c.tar.bz2
Move retail mode's idle->active detection to Chrome.
Retail mode used power_manager to detect idle and active states; powerd now depends on Chrome letting it know of the user activity, which is rate limited to 5s. This introduces a delay in detecting any user activity for either the screensaver or the idle_logout dialog. Change the code to use Chrome's UserActivityDetector to detect user activity instead. Additionally the user activity detector is also rate limited to 1s; reduce this to 200s since it is a cheap operation. This CL also fixes a couple of other bugs that have made KioskMode unusable current builds. 1.) Get the profile for the user on the UI thread (this was being done on the file thread, causing a CalledOnValidThread check failure). 2.) Add a @ to the demo user since this is checked in gaia_auth_util.cc - CanonicalizeEmail. Not having the @ will cause a NOTREACHED. R=derat@chromium.org BUG=143706 TEST=The screensaver goes away as soon as the user presses a key or moves the mouse, even if it has been up for less than 5 seconds. Similarly, the idle logout dialog should cancel immidiately in case of any user activity. Review URL: https://chromiumcodereview.appspot.com/10868004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152895 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm/user_activity_detector.cc')
-rw-r--r--ash/wm/user_activity_detector.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/ash/wm/user_activity_detector.cc b/ash/wm/user_activity_detector.cc
index ad4dcf5..3d2b4f3 100644
--- a/ash/wm/user_activity_detector.cc
+++ b/ash/wm/user_activity_detector.cc
@@ -12,7 +12,7 @@
namespace ash {
-const double UserActivityDetector::kNotifyIntervalSec = 1.0;
+const double UserActivityDetector::kNotifyIntervalMs = 200.0;
UserActivityDetector::UserActivityDetector() {
}
@@ -20,6 +20,10 @@ UserActivityDetector::UserActivityDetector() {
UserActivityDetector::~UserActivityDetector() {
}
+bool UserActivityDetector::HasObserver(UserActivityObserver* observer) const {
+ return observers_.HasObserver(observer);
+}
+
void UserActivityDetector::AddObserver(UserActivityObserver* observer) {
observers_.AddObserver(observer);
}
@@ -69,8 +73,8 @@ void UserActivityDetector::MaybeNotify() {
base::TimeTicks now =
!now_for_test_.is_null() ? now_for_test_ : base::TimeTicks::Now();
if (last_observer_notification_time_.is_null() ||
- (now - last_observer_notification_time_).InSecondsF() >=
- kNotifyIntervalSec) {
+ (now - last_observer_notification_time_).InMillisecondsF() >=
+ kNotifyIntervalMs) {
FOR_EACH_OBSERVER(UserActivityObserver, observers_, OnUserActivity());
last_observer_notification_time_ = now;
}