OLD | NEW |
1 | 1 |
2 // Copyright 2014 The Chromium Authors. All rights reserved. | 2 // Copyright 2014 The Chromium Authors. All rights reserved. |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 | 5 |
6 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_MOTION_EVENT_ANDROID_H_ | 6 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_MOTION_EVENT_ANDROID_H_ |
7 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_MOTION_EVENT_ANDROID_H_ | 7 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_MOTION_EVENT_ANDROID_H_ |
8 | 8 |
9 #include <jni.h> | 9 #include <jni.h> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 // while all *output* coordinates are in DIPs (as with WebTouchEvent). | 22 // while all *output* coordinates are in DIPs (as with WebTouchEvent). |
23 class CONTENT_EXPORT MotionEventAndroid : public ui::MotionEvent { | 23 class CONTENT_EXPORT MotionEventAndroid : public ui::MotionEvent { |
24 public: | 24 public: |
25 struct Pointer { | 25 struct Pointer { |
26 Pointer(jint id, | 26 Pointer(jint id, |
27 jfloat pos_x_pixels, | 27 jfloat pos_x_pixels, |
28 jfloat pos_y_pixels, | 28 jfloat pos_y_pixels, |
29 jfloat touch_major_pixels, | 29 jfloat touch_major_pixels, |
30 jfloat touch_minor_pixels, | 30 jfloat touch_minor_pixels, |
31 jfloat orientation_rad, | 31 jfloat orientation_rad, |
| 32 jfloat tilt_rad, |
32 jint tool_type); | 33 jint tool_type); |
33 jint id; | 34 jint id; |
34 jfloat pos_x_pixels; | 35 jfloat pos_x_pixels; |
35 jfloat pos_y_pixels; | 36 jfloat pos_y_pixels; |
36 jfloat touch_major_pixels; | 37 jfloat touch_major_pixels; |
37 jfloat touch_minor_pixels; | 38 jfloat touch_minor_pixels; |
38 jfloat orientation_rad; | 39 jfloat orientation_rad; |
| 40 jfloat tilt_rad; |
39 jint tool_type; | 41 jint tool_type; |
40 }; | 42 }; |
41 | 43 |
42 // Forcing the caller to provide all cached values upon construction | 44 // Forcing the caller to provide all cached values upon construction |
43 // eliminates the need to perform a JNI call to retrieve values individually. | 45 // eliminates the need to perform a JNI call to retrieve values individually. |
44 MotionEventAndroid(float pix_to_dip, | 46 MotionEventAndroid(float pix_to_dip, |
45 JNIEnv* env, | 47 JNIEnv* env, |
46 jobject event, | 48 jobject event, |
47 jlong time_ms, | 49 jlong time_ms, |
48 jint android_action, | 50 jint android_action, |
(...skipping 15 matching lines...) Expand all Loading... |
64 size_t GetPointerCount() const override; | 66 size_t GetPointerCount() const override; |
65 int GetPointerId(size_t pointer_index) const override; | 67 int GetPointerId(size_t pointer_index) const override; |
66 float GetX(size_t pointer_index) const override; | 68 float GetX(size_t pointer_index) const override; |
67 float GetY(size_t pointer_index) const override; | 69 float GetY(size_t pointer_index) const override; |
68 float GetRawX(size_t pointer_index) const override; | 70 float GetRawX(size_t pointer_index) const override; |
69 float GetRawY(size_t pointer_index) const override; | 71 float GetRawY(size_t pointer_index) const override; |
70 float GetTouchMajor(size_t pointer_index) const override; | 72 float GetTouchMajor(size_t pointer_index) const override; |
71 float GetTouchMinor(size_t pointer_index) const override; | 73 float GetTouchMinor(size_t pointer_index) const override; |
72 float GetOrientation(size_t pointer_index) const override; | 74 float GetOrientation(size_t pointer_index) const override; |
73 float GetPressure(size_t pointer_index) const override; | 75 float GetPressure(size_t pointer_index) const override; |
| 76 // TODO(e_hakkinen): Remove either GetTiltOrientation or GetTiltX and |
| 77 // GetTiltY. |
| 78 float GetTilt(size_t pointer_index) const override; |
| 79 float GetTiltOrientation(size_t pointer_index) const override; |
| 80 float GetTiltX(size_t pointer_index) const override; |
| 81 float GetTiltY(size_t pointer_index) const override; |
74 base::TimeTicks GetEventTime() const override; | 82 base::TimeTicks GetEventTime() const override; |
75 size_t GetHistorySize() const override; | 83 size_t GetHistorySize() const override; |
76 base::TimeTicks GetHistoricalEventTime( | 84 base::TimeTicks GetHistoricalEventTime( |
77 size_t historical_index) const override; | 85 size_t historical_index) const override; |
78 float GetHistoricalTouchMajor(size_t pointer_index, | 86 float GetHistoricalTouchMajor(size_t pointer_index, |
79 size_t historical_index) const override; | 87 size_t historical_index) const override; |
80 float GetHistoricalX(size_t pointer_index, | 88 float GetHistoricalX(size_t pointer_index, |
81 size_t historical_index) const override; | 89 size_t historical_index) const override; |
82 float GetHistoricalY(size_t pointer_index, | 90 float GetHistoricalY(size_t pointer_index, |
83 size_t historical_index) const override; | 91 size_t historical_index) const override; |
(...skipping 29 matching lines...) Expand all Loading... |
113 const int cached_button_state_; | 121 const int cached_button_state_; |
114 const int cached_flags_; | 122 const int cached_flags_; |
115 const gfx::Vector2dF cached_raw_position_offset_; | 123 const gfx::Vector2dF cached_raw_position_offset_; |
116 struct CachedPointer { | 124 struct CachedPointer { |
117 CachedPointer(); | 125 CachedPointer(); |
118 int id; | 126 int id; |
119 gfx::PointF position; | 127 gfx::PointF position; |
120 float touch_major; | 128 float touch_major; |
121 float touch_minor; | 129 float touch_minor; |
122 float orientation; | 130 float orientation; |
| 131 float tilt; |
123 ToolType tool_type; | 132 ToolType tool_type; |
124 } cached_pointers_[MAX_POINTERS_TO_CACHE]; | 133 } cached_pointers_[MAX_POINTERS_TO_CACHE]; |
125 | 134 |
126 // A unique identifier for the Android motion event. | 135 // A unique identifier for the Android motion event. |
127 const uint32 unique_event_id_; | 136 const uint32 unique_event_id_; |
128 | 137 |
129 DISALLOW_COPY_AND_ASSIGN(MotionEventAndroid); | 138 DISALLOW_COPY_AND_ASSIGN(MotionEventAndroid); |
130 }; | 139 }; |
131 | 140 |
132 } // namespace content | 141 } // namespace content |
133 | 142 |
134 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_MOTION_EVENT_ANDROID_H_ | 143 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_MOTION_EVENT_ANDROID_H_ |
OLD | NEW |