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_WM_CORE_USER_ACTIVITY_DETECTOR_H_ | 5 #ifndef UI_WM_CORE_USER_ACTIVITY_DETECTOR_H_ |
6 #define UI_WM_CORE_USER_ACTIVITY_DETECTOR_H_ | 6 #define UI_WM_CORE_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 23 matching lines...) Expand all Loading... |
34 void set_now_for_test(base::TimeTicks now) { now_for_test_ = now; } | 34 void set_now_for_test(base::TimeTicks now) { now_for_test_ = now; } |
35 | 35 |
36 bool HasObserver(UserActivityObserver* observer) const; | 36 bool HasObserver(UserActivityObserver* observer) const; |
37 void AddObserver(UserActivityObserver* observer); | 37 void AddObserver(UserActivityObserver* observer); |
38 void RemoveObserver(UserActivityObserver* observer); | 38 void RemoveObserver(UserActivityObserver* observer); |
39 | 39 |
40 // Called when displays are about to be turned on or off. | 40 // Called when displays are about to be turned on or off. |
41 void OnDisplayPowerChanging(); | 41 void OnDisplayPowerChanging(); |
42 | 42 |
43 // ui::EventHandler implementation. | 43 // ui::EventHandler implementation. |
44 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; | 44 virtual void OnKeyEvent(ui::KeyEvent* event) override; |
45 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; | 45 virtual void OnMouseEvent(ui::MouseEvent* event) override; |
46 virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; | 46 virtual void OnScrollEvent(ui::ScrollEvent* event) override; |
47 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE; | 47 virtual void OnTouchEvent(ui::TouchEvent* event) override; |
48 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 48 virtual void OnGestureEvent(ui::GestureEvent* event) override; |
49 | 49 |
50 private: | 50 private: |
51 // Returns |now_for_test_| if set or base::TimeTicks::Now() otherwise. | 51 // Returns |now_for_test_| if set or base::TimeTicks::Now() otherwise. |
52 base::TimeTicks GetCurrentTime() const; | 52 base::TimeTicks GetCurrentTime() const; |
53 | 53 |
54 // Updates |last_activity_time_|. Additionally notifies observers and | 54 // Updates |last_activity_time_|. Additionally notifies observers and |
55 // updates |last_observer_notification_time_| if enough time has passed | 55 // updates |last_observer_notification_time_| if enough time has passed |
56 // since the last notification. | 56 // since the last notification. |
57 void HandleActivity(const ui::Event* event); | 57 void HandleActivity(const ui::Event* event); |
58 | 58 |
(...skipping 13 matching lines...) Expand all Loading... |
72 // is to avoid reporting mouse events that occur when displays are turned | 72 // is to avoid reporting mouse events that occur when displays are turned |
73 // on or off as user activity. | 73 // on or off as user activity. |
74 base::TimeTicks honor_mouse_events_time_; | 74 base::TimeTicks honor_mouse_events_time_; |
75 | 75 |
76 DISALLOW_COPY_AND_ASSIGN(UserActivityDetector); | 76 DISALLOW_COPY_AND_ASSIGN(UserActivityDetector); |
77 }; | 77 }; |
78 | 78 |
79 } // namespace wm | 79 } // namespace wm |
80 | 80 |
81 #endif // UI_WM_CORE_USER_ACTIVITY_DETECTOR_H_ | 81 #endif // UI_WM_CORE_USER_ACTIVITY_DETECTOR_H_ |
OLD | NEW |