| 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 "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
| 10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 aura::Window* target, | 51 aura::Window* target, |
| 52 ui::TouchEvent* event) { | 52 ui::TouchEvent* event) { |
| 53 if (!GetRootWindowController(target->GetRootWindow())) | 53 if (!GetRootWindowController(target->GetRootWindow())) |
| 54 return ui::TOUCH_STATUS_END; | 54 return ui::TOUCH_STATUS_END; |
| 55 MaybeNotify(); | 55 MaybeNotify(); |
| 56 return ui::TOUCH_STATUS_UNKNOWN; | 56 return ui::TOUCH_STATUS_UNKNOWN; |
| 57 } | 57 } |
| 58 | 58 |
| 59 ui::GestureStatus UserActivityDetector::PreHandleGestureEvent( | 59 ui::GestureStatus UserActivityDetector::PreHandleGestureEvent( |
| 60 aura::Window* target, | 60 aura::Window* target, |
| 61 ui::GestureEventImpl* event) { | 61 ui::GestureEvent* event) { |
| 62 if (!GetRootWindowController(target->GetRootWindow())) | 62 if (!GetRootWindowController(target->GetRootWindow())) |
| 63 return ui::GESTURE_STATUS_CONSUMED; | 63 return ui::GESTURE_STATUS_CONSUMED; |
| 64 MaybeNotify(); | 64 MaybeNotify(); |
| 65 return ui::GESTURE_STATUS_UNKNOWN; | 65 return ui::GESTURE_STATUS_UNKNOWN; |
| 66 } | 66 } |
| 67 | 67 |
| 68 void UserActivityDetector::MaybeNotify() { | 68 void UserActivityDetector::MaybeNotify() { |
| 69 base::TimeTicks now = | 69 base::TimeTicks now = |
| 70 !now_for_test_.is_null() ? now_for_test_ : base::TimeTicks::Now(); | 70 !now_for_test_.is_null() ? now_for_test_ : base::TimeTicks::Now(); |
| 71 if (last_observer_notification_time_.is_null() || | 71 if (last_observer_notification_time_.is_null() || |
| 72 (now - last_observer_notification_time_).InSecondsF() >= | 72 (now - last_observer_notification_time_).InSecondsF() >= |
| 73 kNotifyIntervalSec) { | 73 kNotifyIntervalSec) { |
| 74 FOR_EACH_OBSERVER(UserActivityObserver, observers_, OnUserActivity()); | 74 FOR_EACH_OBSERVER(UserActivityObserver, observers_, OnUserActivity()); |
| 75 last_observer_notification_time_ = now; | 75 last_observer_notification_time_ = now; |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 | 78 |
| 79 } // namespace ash | 79 } // namespace ash |
| OLD | NEW |