| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef UI_BASE_USER_ACTIVITY_USER_ACTIVITY_DETECTOR_H_ | 5 #ifndef UI_BASE_USER_ACTIVITY_USER_ACTIVITY_DETECTOR_H_ |
| 6 #define UI_BASE_USER_ACTIVITY_USER_ACTIVITY_DETECTOR_H_ | 6 #define UI_BASE_USER_ACTIVITY_USER_ACTIVITY_DETECTOR_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 base::TimeTicks GetCurrentTime() const; | 55 base::TimeTicks GetCurrentTime() const; |
| 56 | 56 |
| 57 // Processes the event after it has been converted from a PlatformEvent. | 57 // Processes the event after it has been converted from a PlatformEvent. |
| 58 void ProcessReceivedEvent(const ui::Event* event); | 58 void ProcessReceivedEvent(const ui::Event* event); |
| 59 | 59 |
| 60 // Updates |last_activity_time_|. Additionally notifies observers and | 60 // Updates |last_activity_time_|. Additionally notifies observers and |
| 61 // updates |last_observer_notification_time_| if enough time has passed | 61 // updates |last_observer_notification_time_| if enough time has passed |
| 62 // since the last notification. | 62 // since the last notification. |
| 63 void HandleActivity(const ui::Event* event); | 63 void HandleActivity(const ui::Event* event); |
| 64 | 64 |
| 65 ObserverList<UserActivityObserver> observers_; | 65 base::ObserverList<UserActivityObserver> observers_; |
| 66 | 66 |
| 67 // Last time at which user activity was observed. | 67 // Last time at which user activity was observed. |
| 68 base::TimeTicks last_activity_time_; | 68 base::TimeTicks last_activity_time_; |
| 69 | 69 |
| 70 // Last time at which we notified observers that the user was active. | 70 // Last time at which we notified observers that the user was active. |
| 71 base::TimeTicks last_observer_notification_time_; | 71 base::TimeTicks last_observer_notification_time_; |
| 72 | 72 |
| 73 // If set, used when the current time is needed. This can be set by tests to | 73 // If set, used when the current time is needed. This can be set by tests to |
| 74 // simulate the passage of time. | 74 // simulate the passage of time. |
| 75 base::TimeTicks now_for_test_; | 75 base::TimeTicks now_for_test_; |
| 76 | 76 |
| 77 // If set, mouse events will be ignored until this time is reached. This | 77 // If set, mouse events will be ignored until this time is reached. This |
| 78 // is to avoid reporting mouse events that occur when displays are turned | 78 // is to avoid reporting mouse events that occur when displays are turned |
| 79 // on or off as user activity. | 79 // on or off as user activity. |
| 80 base::TimeTicks honor_mouse_events_time_; | 80 base::TimeTicks honor_mouse_events_time_; |
| 81 | 81 |
| 82 DISALLOW_COPY_AND_ASSIGN(UserActivityDetector); | 82 DISALLOW_COPY_AND_ASSIGN(UserActivityDetector); |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 } // namespace ui | 85 } // namespace ui |
| 86 | 86 |
| 87 #endif // UI_BASE_USER_ACTIVITY_USER_ACTIVITY_DETECTOR_H_ | 87 #endif // UI_BASE_USER_ACTIVITY_USER_ACTIVITY_DETECTOR_H_ |
| OLD | NEW |