summaryrefslogtreecommitdiffstats
path: root/ash/wm/user_activity_detector.cc
diff options
context:
space:
mode:
authorderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-21 20:36:34 +0000
committerderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-21 20:36:34 +0000
commit10b688f204a81d8447c83021624220607353552e (patch)
tree88b29688bc612ddd5137b32b3c6cf9f1f09750fa /ash/wm/user_activity_detector.cc
parent47cadc4c09a3732a47efdb561cd6555735487841 (diff)
downloadchromium_src-10b688f204a81d8447c83021624220607353552e.zip
chromium_src-10b688f204a81d8447c83021624220607353552e.tar.gz
chromium_src-10b688f204a81d8447c83021624220607353552e.tar.bz2
ash: Make UserActivityDetector ignore synthetic mouse events
This may have been preventing us from suspending (e.g. mouse event is synthesized in response to lock window being shown so Chrome tells powerd that the user is active). BUG=133419 TEST=added Review URL: https://chromiumcodereview.appspot.com/10574044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143437 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm/user_activity_detector.cc')
-rw-r--r--ash/wm/user_activity_detector.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/ash/wm/user_activity_detector.cc b/ash/wm/user_activity_detector.cc
index 536419b..5329087 100644
--- a/ash/wm/user_activity_detector.cc
+++ b/ash/wm/user_activity_detector.cc
@@ -5,6 +5,7 @@
#include "ash/wm/user_activity_detector.h"
#include "ash/wm/user_activity_observer.h"
+#include "ui/aura/event.h"
namespace ash {
@@ -32,7 +33,8 @@ bool UserActivityDetector::PreHandleKeyEvent(aura::Window* target,
bool UserActivityDetector::PreHandleMouseEvent(aura::Window* target,
aura::MouseEvent* event) {
- MaybeNotify();
+ if (!(event->flags() & ui::EF_IS_SYNTHESIZED))
+ MaybeNotify();
return false;
}
@@ -51,7 +53,8 @@ ui::GestureStatus UserActivityDetector::PreHandleGestureEvent(
}
void UserActivityDetector::MaybeNotify() {
- base::TimeTicks now = base::TimeTicks::Now();
+ 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) {