| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/wm/user_activity_detector.h" | 5 #include "ash/wm/user_activity_detector.h" |
| 6 | 6 |
| 7 #include "ash/wm/property_util.h" | 7 #include "ash/wm/property_util.h" |
| 8 #include "ash/wm/user_activity_observer.h" | 8 #include "ash/wm/user_activity_observer.h" |
| 9 #include "ui/base/event.h" | 9 #include "ui/base/event.h" |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 return false; | 43 return false; |
| 44 } | 44 } |
| 45 | 45 |
| 46 ui::TouchStatus UserActivityDetector::PreHandleTouchEvent( | 46 ui::TouchStatus UserActivityDetector::PreHandleTouchEvent( |
| 47 aura::Window* target, | 47 aura::Window* target, |
| 48 ui::TouchEvent* event) { | 48 ui::TouchEvent* event) { |
| 49 MaybeNotify(); | 49 MaybeNotify(); |
| 50 return ui::TOUCH_STATUS_UNKNOWN; | 50 return ui::TOUCH_STATUS_UNKNOWN; |
| 51 } | 51 } |
| 52 | 52 |
| 53 ui::GestureStatus UserActivityDetector::PreHandleGestureEvent( | 53 ui::EventResult UserActivityDetector::PreHandleGestureEvent( |
| 54 aura::Window* target, | 54 aura::Window* target, |
| 55 ui::GestureEvent* event) { | 55 ui::GestureEvent* event) { |
| 56 MaybeNotify(); | 56 MaybeNotify(); |
| 57 return ui::GESTURE_STATUS_UNKNOWN; | 57 return ui::ER_UNHANDLED; |
| 58 } | 58 } |
| 59 | 59 |
| 60 void UserActivityDetector::MaybeNotify() { | 60 void UserActivityDetector::MaybeNotify() { |
| 61 base::TimeTicks now = | 61 base::TimeTicks now = |
| 62 !now_for_test_.is_null() ? now_for_test_ : base::TimeTicks::Now(); | 62 !now_for_test_.is_null() ? now_for_test_ : base::TimeTicks::Now(); |
| 63 if (last_observer_notification_time_.is_null() || | 63 if (last_observer_notification_time_.is_null() || |
| 64 (now - last_observer_notification_time_).InMillisecondsF() >= | 64 (now - last_observer_notification_time_).InMillisecondsF() >= |
| 65 kNotifyIntervalMs) { | 65 kNotifyIntervalMs) { |
| 66 FOR_EACH_OBSERVER(UserActivityObserver, observers_, OnUserActivity()); | 66 FOR_EACH_OBSERVER(UserActivityObserver, observers_, OnUserActivity()); |
| 67 last_observer_notification_time_ = now; | 67 last_observer_notification_time_ = now; |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 } // namespace ash | 71 } // namespace ash |
| OLD | NEW |