| 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_ANDROID_MOTION_EVENT_ANDROID_H_ | 5 #ifndef UI_EVENTS_ANDROID_MOTION_EVENT_ANDROID_H_ |
| 6 #define UI_EVENTS_ANDROID_MOTION_EVENT_ANDROID_H_ | 6 #define UI_EVENTS_ANDROID_MOTION_EVENT_ANDROID_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 jfloat touch_minor_pixels, | 33 jfloat touch_minor_pixels, |
| 34 jfloat orientation_rad, | 34 jfloat orientation_rad, |
| 35 jfloat tilt_rad, | 35 jfloat tilt_rad, |
| 36 jint tool_type); | 36 jint tool_type); |
| 37 jint id; | 37 jint id; |
| 38 jfloat pos_x_pixels; | 38 jfloat pos_x_pixels; |
| 39 jfloat pos_y_pixels; | 39 jfloat pos_y_pixels; |
| 40 jfloat touch_major_pixels; | 40 jfloat touch_major_pixels; |
| 41 jfloat touch_minor_pixels; | 41 jfloat touch_minor_pixels; |
| 42 jfloat orientation_rad; | 42 jfloat orientation_rad; |
| 43 // Unlike the tilt angles in motion_event.h, this field matches the |
| 44 // MotionEvent spec because we get this values from Java. |
| 43 jfloat tilt_rad; | 45 jfloat tilt_rad; |
| 44 jint tool_type; | 46 jint tool_type; |
| 45 }; | 47 }; |
| 46 | 48 |
| 47 // Forcing the caller to provide all cached values upon construction | 49 // Forcing the caller to provide all cached values upon construction |
| 48 // eliminates the need to perform a JNI call to retrieve values individually. | 50 // eliminates the need to perform a JNI call to retrieve values individually. |
| 49 MotionEventAndroid(JNIEnv* env, | 51 MotionEventAndroid(JNIEnv* env, |
| 50 jobject event, | 52 jobject event, |
| 51 jfloat pix_to_dip, | 53 jfloat pix_to_dip, |
| 52 jfloat ticks_x, | 54 jfloat ticks_x, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 75 size_t GetPointerCount() const override; | 77 size_t GetPointerCount() const override; |
| 76 int GetPointerId(size_t pointer_index) const override; | 78 int GetPointerId(size_t pointer_index) const override; |
| 77 float GetX(size_t pointer_index) const override; | 79 float GetX(size_t pointer_index) const override; |
| 78 float GetY(size_t pointer_index) const override; | 80 float GetY(size_t pointer_index) const override; |
| 79 float GetRawX(size_t pointer_index) const override; | 81 float GetRawX(size_t pointer_index) const override; |
| 80 float GetRawY(size_t pointer_index) const override; | 82 float GetRawY(size_t pointer_index) const override; |
| 81 float GetTouchMajor(size_t pointer_index) const override; | 83 float GetTouchMajor(size_t pointer_index) const override; |
| 82 float GetTouchMinor(size_t pointer_index) const override; | 84 float GetTouchMinor(size_t pointer_index) const override; |
| 83 float GetOrientation(size_t pointer_index) const override; | 85 float GetOrientation(size_t pointer_index) const override; |
| 84 float GetPressure(size_t pointer_index) const override; | 86 float GetPressure(size_t pointer_index) const override; |
| 85 float GetTilt(size_t pointer_index) const override; | 87 float GetTiltX(size_t pointer_index) const override; |
| 88 float GetTiltY(size_t pointer_index) const override; |
| 86 base::TimeTicks GetEventTime() const override; | 89 base::TimeTicks GetEventTime() const override; |
| 87 size_t GetHistorySize() const override; | 90 size_t GetHistorySize() const override; |
| 88 base::TimeTicks GetHistoricalEventTime( | 91 base::TimeTicks GetHistoricalEventTime( |
| 89 size_t historical_index) const override; | 92 size_t historical_index) const override; |
| 90 float GetHistoricalTouchMajor(size_t pointer_index, | 93 float GetHistoricalTouchMajor(size_t pointer_index, |
| 91 size_t historical_index) const override; | 94 size_t historical_index) const override; |
| 92 float GetHistoricalX(size_t pointer_index, | 95 float GetHistoricalX(size_t pointer_index, |
| 93 size_t historical_index) const override; | 96 size_t historical_index) const override; |
| 94 float GetHistoricalY(size_t pointer_index, | 97 float GetHistoricalY(size_t pointer_index, |
| 95 size_t historical_index) const override; | 98 size_t historical_index) const override; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 const int cached_button_state_; | 144 const int cached_button_state_; |
| 142 const int cached_flags_; | 145 const int cached_flags_; |
| 143 const gfx::Vector2dF cached_raw_position_offset_; | 146 const gfx::Vector2dF cached_raw_position_offset_; |
| 144 struct CachedPointer { | 147 struct CachedPointer { |
| 145 CachedPointer(); | 148 CachedPointer(); |
| 146 int id; | 149 int id; |
| 147 gfx::PointF position; | 150 gfx::PointF position; |
| 148 float touch_major; | 151 float touch_major; |
| 149 float touch_minor; | 152 float touch_minor; |
| 150 float orientation; | 153 float orientation; |
| 151 float tilt; | 154 float tilt_x; |
| 155 float tilt_y; |
| 152 ToolType tool_type; | 156 ToolType tool_type; |
| 153 } cached_pointers_[MAX_POINTERS_TO_CACHE]; | 157 } cached_pointers_[MAX_POINTERS_TO_CACHE]; |
| 154 | 158 |
| 155 // A unique identifier for the Android motion event. | 159 // A unique identifier for the Android motion event. |
| 156 const uint32_t unique_event_id_; | 160 const uint32_t unique_event_id_; |
| 157 | 161 |
| 158 // Disallow copy/assign. | 162 // Disallow copy/assign. |
| 159 MotionEventAndroid(const MotionEventAndroid& e); // private ctor | 163 MotionEventAndroid(const MotionEventAndroid& e); // private ctor |
| 160 void operator=(const MotionEventAndroid&) = delete; | 164 void operator=(const MotionEventAndroid&) = delete; |
| 161 }; | 165 }; |
| 162 | 166 |
| 163 } // namespace content | 167 } // namespace content |
| 164 | 168 |
| 165 #endif // UI_EVENTS_ANDROID_MOTION_EVENT_ANDROID_H_ | 169 #endif // UI_EVENTS_ANDROID_MOTION_EVENT_ANDROID_H_ |
| OLD | NEW |