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_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ | 5 #ifndef UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ |
6 #define UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ | 6 #define UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 virtual float GetRawY(size_t pointer_index) const override; | 35 virtual float GetRawY(size_t pointer_index) const override; |
36 virtual float GetTouchMajor(size_t pointer_index) const override; | 36 virtual float GetTouchMajor(size_t pointer_index) const override; |
37 virtual float GetTouchMinor(size_t pointer_index) const override; | 37 virtual float GetTouchMinor(size_t pointer_index) const override; |
38 virtual float GetOrientation(size_t pointer_index) const override; | 38 virtual float GetOrientation(size_t pointer_index) const override; |
39 virtual float GetPressure(size_t pointer_index) const override; | 39 virtual float GetPressure(size_t pointer_index) const override; |
40 virtual ToolType GetToolType(size_t pointer_index) const override; | 40 virtual ToolType GetToolType(size_t pointer_index) const override; |
41 virtual int GetButtonState() const override; | 41 virtual int GetButtonState() const override; |
42 virtual int GetFlags() const override; | 42 virtual int GetFlags() const override; |
43 virtual base::TimeTicks GetEventTime() const override; | 43 virtual base::TimeTicks GetEventTime() const override; |
44 | 44 |
45 virtual scoped_ptr<MotionEvent> Clone() const override; | |
46 virtual scoped_ptr<MotionEvent> Cancel() const override; | |
47 | |
48 int GetSourceDeviceId(size_t pointer_index) const; | 45 int GetSourceDeviceId(size_t pointer_index) const; |
49 | 46 |
50 // We can't cleanup removed touch points immediately upon receipt of a | 47 // We can't cleanup removed touch points immediately upon receipt of a |
51 // TouchCancel or TouchRelease, as the MotionEvent needs to be able to report | 48 // TouchCancel or TouchRelease, as the MotionEvent needs to be able to report |
52 // information about those touch events. Once the MotionEvent has been | 49 // information about those touch events. Once the MotionEvent has been |
53 // processed, we call CleanupRemovedTouchPoints to do the required | 50 // processed, we call CleanupRemovedTouchPoints to do the required |
54 // book-keeping. | 51 // book-keeping. |
55 void CleanupRemovedTouchPoints(const TouchEvent& event); | 52 void CleanupRemovedTouchPoints(const TouchEvent& event); |
56 | 53 |
57 private: | 54 private: |
(...skipping 16 matching lines...) Expand all Loading... |
74 const base::TimeTicks& last_touch_time, | 71 const base::TimeTicks& last_touch_time, |
75 Action cached_action, | 72 Action cached_action, |
76 int cached_action_index, | 73 int cached_action_index, |
77 int flags, | 74 int flags, |
78 const PointData (&active_touches)[MotionEvent::MAX_TOUCH_POINT_COUNT]); | 75 const PointData (&active_touches)[MotionEvent::MAX_TOUCH_POINT_COUNT]); |
79 | 76 |
80 static PointData GetPointDataFromTouchEvent(const TouchEvent& touch); | 77 static PointData GetPointDataFromTouchEvent(const TouchEvent& touch); |
81 void AddTouch(const TouchEvent& touch); | 78 void AddTouch(const TouchEvent& touch); |
82 void UpdateTouch(const TouchEvent& touch); | 79 void UpdateTouch(const TouchEvent& touch); |
83 void UpdateCachedAction(const TouchEvent& touch); | 80 void UpdateCachedAction(const TouchEvent& touch); |
84 size_t GetIndexFromId(int id) const; | 81 int GetIndexFromId(int id) const; |
85 | 82 |
86 size_t pointer_count_; | 83 size_t pointer_count_; |
87 base::TimeTicks last_touch_time_; | 84 base::TimeTicks last_touch_time_; |
88 Action cached_action_; | 85 Action cached_action_; |
89 // The index of the touch responsible for last ACTION_POINTER_DOWN or | 86 // The index of the touch responsible for last ACTION_POINTER_DOWN or |
90 // ACTION_POINTER_UP. -1 if no such action has occurred. | 87 // ACTION_POINTER_UP. -1 if no such action has occurred. |
91 int cached_action_index_; | 88 int cached_action_index_; |
92 int flags_; | 89 int flags_; |
93 | 90 |
94 // We want constant time indexing by pointer_index, and fast indexing by id. | 91 // We want constant time indexing by pointer_index, and fast indexing by id. |
95 PointData active_touches_[MotionEvent::MAX_TOUCH_POINT_COUNT]; | 92 PointData active_touches_[MotionEvent::MAX_TOUCH_POINT_COUNT]; |
96 | 93 |
97 DISALLOW_COPY_AND_ASSIGN(MotionEventAura); | 94 DISALLOW_COPY_AND_ASSIGN(MotionEventAura); |
98 }; | 95 }; |
99 | 96 |
100 } // namespace ui | 97 } // namespace ui |
101 | 98 |
102 #endif // UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ | 99 #endif // UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ |
OLD | NEW |