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" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "ui/events/event.h" | 12 #include "ui/events/event.h" |
13 #include "ui/events/events_export.h" | 13 #include "ui/events/events_export.h" |
14 #include "ui/events/gesture_detection/motion_event.h" | 14 #include "ui/events/gesture_detection/motion_event.h" |
15 | 15 |
16 namespace ui { | 16 namespace ui { |
17 | 17 |
18 // Implementation of MotionEvent which takes a stream of ui::TouchEvents. | 18 // Implementation of MotionEvent which takes a stream of ui::TouchEvents. |
19 class EVENTS_EXPORT MotionEventAura : public MotionEvent { | 19 class EVENTS_EXPORT MotionEventAura : public MotionEvent { |
20 public: | 20 public: |
21 MotionEventAura(); | 21 MotionEventAura(); |
22 virtual ~MotionEventAura(); | 22 ~MotionEventAura() override; |
23 | 23 |
24 void OnTouch(const TouchEvent& touch); | 24 void OnTouch(const TouchEvent& touch); |
25 | 25 |
26 // MotionEvent implementation. | 26 // MotionEvent implementation. |
27 virtual int GetId() const override; | 27 int GetId() const override; |
28 virtual Action GetAction() const override; | 28 Action GetAction() const override; |
29 virtual int GetActionIndex() const override; | 29 int GetActionIndex() const override; |
30 virtual size_t GetPointerCount() const override; | 30 size_t GetPointerCount() const override; |
31 virtual int GetPointerId(size_t pointer_index) const override; | 31 int GetPointerId(size_t pointer_index) const override; |
32 virtual float GetX(size_t pointer_index) const override; | 32 float GetX(size_t pointer_index) const override; |
33 virtual float GetY(size_t pointer_index) const override; | 33 float GetY(size_t pointer_index) const override; |
34 virtual float GetRawX(size_t pointer_index) const override; | 34 float GetRawX(size_t pointer_index) const override; |
35 virtual float GetRawY(size_t pointer_index) const override; | 35 float GetRawY(size_t pointer_index) const override; |
36 virtual float GetTouchMajor(size_t pointer_index) const override; | 36 float GetTouchMajor(size_t pointer_index) const override; |
37 virtual float GetTouchMinor(size_t pointer_index) const override; | 37 float GetTouchMinor(size_t pointer_index) const override; |
38 virtual float GetOrientation(size_t pointer_index) const override; | 38 float GetOrientation(size_t pointer_index) const override; |
39 virtual float GetPressure(size_t pointer_index) const override; | 39 float GetPressure(size_t pointer_index) const override; |
40 virtual ToolType GetToolType(size_t pointer_index) const override; | 40 ToolType GetToolType(size_t pointer_index) const override; |
41 virtual int GetButtonState() const override; | 41 int GetButtonState() const override; |
42 virtual int GetFlags() const override; | 42 int GetFlags() const override; |
43 virtual base::TimeTicks GetEventTime() const override; | 43 base::TimeTicks GetEventTime() const override; |
44 | 44 |
45 int GetSourceDeviceId(size_t pointer_index) const; | 45 int GetSourceDeviceId(size_t pointer_index) const; |
46 | 46 |
47 // 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 |
48 // 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 |
49 // information about those touch events. Once the MotionEvent has been | 49 // information about those touch events. Once the MotionEvent has been |
50 // processed, we call CleanupRemovedTouchPoints to do the required | 50 // processed, we call CleanupRemovedTouchPoints to do the required |
51 // book-keeping. | 51 // book-keeping. |
52 void CleanupRemovedTouchPoints(const TouchEvent& event); | 52 void CleanupRemovedTouchPoints(const TouchEvent& event); |
53 | 53 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 // 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. |
92 PointData active_touches_[MotionEvent::MAX_TOUCH_POINT_COUNT]; | 92 PointData active_touches_[MotionEvent::MAX_TOUCH_POINT_COUNT]; |
93 | 93 |
94 DISALLOW_COPY_AND_ASSIGN(MotionEventAura); | 94 DISALLOW_COPY_AND_ASSIGN(MotionEventAura); |
95 }; | 95 }; |
96 | 96 |
97 } // namespace ui | 97 } // namespace ui |
98 | 98 |
99 #endif // UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ | 99 #endif // UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ |
OLD | NEW |