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" | |
8 #include "ash/wm/user_activity_observer.h" | 7 #include "ash/wm/user_activity_observer.h" |
9 #include "ui/events/event.h" | 8 #include "ui/events/event.h" |
10 | 9 |
11 namespace ash { | 10 namespace ash { |
12 | 11 |
13 const int UserActivityDetector::kNotifyIntervalMs = 200; | 12 const int UserActivityDetector::kNotifyIntervalMs = 200; |
14 | 13 |
15 // Too low and mouse events generated at the tail end of reconfiguration | 14 // Too low and mouse events generated at the tail end of reconfiguration |
16 // will be reported as user activity and turn the screen back on; too high | 15 // will be reported as user activity and turn the screen back on; too high |
17 // and we'll ignore legitimate activity. | 16 // and we'll ignore legitimate activity. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 last_activity_time_ = now; | 74 last_activity_time_ = now; |
76 if (last_observer_notification_time_.is_null() || | 75 if (last_observer_notification_time_.is_null() || |
77 (now - last_observer_notification_time_).InMillisecondsF() >= | 76 (now - last_observer_notification_time_).InMillisecondsF() >= |
78 kNotifyIntervalMs) { | 77 kNotifyIntervalMs) { |
79 FOR_EACH_OBSERVER(UserActivityObserver, observers_, OnUserActivity(event)); | 78 FOR_EACH_OBSERVER(UserActivityObserver, observers_, OnUserActivity(event)); |
80 last_observer_notification_time_ = now; | 79 last_observer_notification_time_ = now; |
81 } | 80 } |
82 } | 81 } |
83 | 82 |
84 } // namespace ash | 83 } // namespace ash |
OLD | NEW |