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 "ui/events/gesture_detection/motion_event.h" | |
9 | |
10 #include <map> | 8 #include <map> |
11 | 9 |
12 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
13 #include "base/time/time.h" | 11 #include "base/time/time.h" |
14 #include "ui/events/event.h" | 12 #include "ui/events/event.h" |
15 #include "ui/events/events_export.h" | 13 #include "ui/events/events_export.h" |
16 #include "ui/events/gestures/gesture_sequence.h" | 14 #include "ui/events/gesture_detection/motion_event.h" |
17 | 15 |
18 namespace ui { | 16 namespace ui { |
19 | 17 |
20 // Implementation of MotionEvent which takes a stream of ui::TouchEvents. | 18 // Implementation of MotionEvent which takes a stream of ui::TouchEvents. |
21 class EVENTS_EXPORT MotionEventAura : public MotionEvent { | 19 class EVENTS_EXPORT MotionEventAura : public MotionEvent { |
22 public: | 20 public: |
23 MotionEventAura(); | 21 MotionEventAura(); |
24 virtual ~MotionEventAura(); | 22 virtual ~MotionEventAura(); |
25 | 23 |
26 void OnTouch(const TouchEvent& touch); | 24 void OnTouch(const TouchEvent& touch); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 float pressure; | 62 float pressure; |
65 int source_device_id; | 63 int source_device_id; |
66 float major_radius; | 64 float major_radius; |
67 }; | 65 }; |
68 | 66 |
69 MotionEventAura( | 67 MotionEventAura( |
70 size_t pointer_count, | 68 size_t pointer_count, |
71 const base::TimeTicks& last_touch_time, | 69 const base::TimeTicks& last_touch_time, |
72 Action cached_action, | 70 Action cached_action, |
73 int cached_action_index, | 71 int cached_action_index, |
74 const PointData (&active_touches)[GestureSequence::kMaxGesturePoints]); | 72 const PointData (&active_touches)[10/*TODO*/]); |
75 | 73 |
76 static PointData GetPointDataFromTouchEvent(const TouchEvent& touch); | 74 static PointData GetPointDataFromTouchEvent(const TouchEvent& touch); |
77 void AddTouch(const TouchEvent& touch); | 75 void AddTouch(const TouchEvent& touch); |
78 void UpdateTouch(const TouchEvent& touch); | 76 void UpdateTouch(const TouchEvent& touch); |
79 void UpdateCachedAction(const TouchEvent& touch); | 77 void UpdateCachedAction(const TouchEvent& touch); |
80 size_t GetIndexFromId(int id) const; | 78 size_t GetIndexFromId(int id) const; |
81 | 79 |
82 size_t pointer_count_; | 80 size_t pointer_count_; |
83 base::TimeTicks last_touch_time_; | 81 base::TimeTicks last_touch_time_; |
84 Action cached_action_; | 82 Action cached_action_; |
85 // The index of the touch responsible for last ACTION_POINTER_DOWN or | 83 // The index of the touch responsible for last ACTION_POINTER_DOWN or |
86 // ACTION_POINTER_UP. -1 if no such action has occurred. | 84 // ACTION_POINTER_UP. -1 if no such action has occurred. |
87 int cached_action_index_; | 85 int cached_action_index_; |
88 | 86 |
89 // We want constant time indexing by pointer_index, and fast indexing by id. | 87 // We want constant time indexing by pointer_index, and fast indexing by id. |
90 // TODO(tdresser): figure out which constant to use here. | 88 PointData active_touches_[10/*TODO*/]; |
91 PointData active_touches_[GestureSequence::kMaxGesturePoints]; | |
92 | 89 |
93 DISALLOW_COPY_AND_ASSIGN(MotionEventAura); | 90 DISALLOW_COPY_AND_ASSIGN(MotionEventAura); |
94 }; | 91 }; |
95 | 92 |
96 } // namespace ui | 93 } // namespace ui |
97 | 94 |
98 #endif // UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ | 95 #endif // UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ |
OLD | NEW |