diff options
author | Andras Becsi <andras.becsi@digia.com> | 2013-12-11 21:33:03 +0100 |
---|---|---|
committer | Andras Becsi <andras.becsi@digia.com> | 2013-12-13 12:34:07 +0100 |
commit | f2a33ff9cbc6d19943f1c7fbddd1f23d23975577 (patch) | |
tree | 0586a32aa390ade8557dfd6b4897f43a07449578 /chromium/ash/wm/user_activity_detector.cc | |
parent | 5362912cdb5eea702b68ebe23702468d17c3017a (diff) |
Update Chromium to branch 1650 (31.0.1650.63)
Change-Id: I57d8c832eaec1eb2364e0a8e7352a6dd354db99f
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'chromium/ash/wm/user_activity_detector.cc')
-rw-r--r-- | chromium/ash/wm/user_activity_detector.cc | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/chromium/ash/wm/user_activity_detector.cc b/chromium/ash/wm/user_activity_detector.cc deleted file mode 100644 index 269b9efe860..00000000000 --- a/chromium/ash/wm/user_activity_detector.cc +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ash/wm/user_activity_detector.h" - -#include "ash/wm/property_util.h" -#include "ash/wm/user_activity_observer.h" -#include "ui/base/events/event.h" - -namespace ash { - -const int UserActivityDetector::kNotifyIntervalMs = 200; - -// Too low and mouse events generated at the tail end of reconfiguration -// will be reported as user activity and turn the screen back on; too high -// and we'll ignore legitimate activity. -const int UserActivityDetector::kDisplayPowerChangeIgnoreMouseMs = 1000; - -UserActivityDetector::UserActivityDetector() { -} - -UserActivityDetector::~UserActivityDetector() { -} - -bool UserActivityDetector::HasObserver(UserActivityObserver* observer) const { - return observers_.HasObserver(observer); -} - -void UserActivityDetector::AddObserver(UserActivityObserver* observer) { - observers_.AddObserver(observer); -} - -void UserActivityDetector::RemoveObserver(UserActivityObserver* observer) { - observers_.RemoveObserver(observer); -} - -void UserActivityDetector::OnDisplayPowerChanging() { - honor_mouse_events_time_ = GetCurrentTime() + - base::TimeDelta::FromMilliseconds(kDisplayPowerChangeIgnoreMouseMs); -} - -void UserActivityDetector::OnKeyEvent(ui::KeyEvent* event) { - HandleActivity(event); -} - -void UserActivityDetector::OnMouseEvent(ui::MouseEvent* event) { - if (event->flags() & ui::EF_IS_SYNTHESIZED) - return; - if (!honor_mouse_events_time_.is_null() && - GetCurrentTime() < honor_mouse_events_time_) - return; - - HandleActivity(event); -} - -void UserActivityDetector::OnScrollEvent(ui::ScrollEvent* event) { - HandleActivity(event); -} - -void UserActivityDetector::OnTouchEvent(ui::TouchEvent* event) { - HandleActivity(event); -} - -void UserActivityDetector::OnGestureEvent(ui::GestureEvent* event) { - HandleActivity(event); -} - -base::TimeTicks UserActivityDetector::GetCurrentTime() const { - return !now_for_test_.is_null() ? now_for_test_ : base::TimeTicks::Now(); -} - -void UserActivityDetector::HandleActivity(const ui::Event* event) { - base::TimeTicks now = GetCurrentTime(); - last_activity_time_ = now; - if (last_observer_notification_time_.is_null() || - (now - last_observer_notification_time_).InMillisecondsF() >= - kNotifyIntervalMs) { - FOR_EACH_OBSERVER(UserActivityObserver, observers_, OnUserActivity(event)); - last_observer_notification_time_ = now; - } -} - -} // namespace ash |