| 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 CONTENT_BROWSER_RENDERER_HOST_INPUT_MOTION_EVENT_ANDROID_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_MOTION_EVENT_ANDROID_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_MOTION_EVENT_ANDROID_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_MOTION_EVENT_ANDROID_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 jint action_index, | 32 jint action_index, |
| 33 jfloat pos_x_0_pixels, | 33 jfloat pos_x_0_pixels, |
| 34 jfloat pos_y_0_pixels, | 34 jfloat pos_y_0_pixels, |
| 35 jfloat pos_x_1_pixels, | 35 jfloat pos_x_1_pixels, |
| 36 jfloat pos_y_1_pixels, | 36 jfloat pos_y_1_pixels, |
| 37 jint pointer_id_0, | 37 jint pointer_id_0, |
| 38 jint pointer_id_1, | 38 jint pointer_id_1, |
| 39 jfloat touch_major_0_pixels, | 39 jfloat touch_major_0_pixels, |
| 40 jfloat touch_major_1_pixels, | 40 jfloat touch_major_1_pixels, |
| 41 jfloat raw_pos_x_pixels, | 41 jfloat raw_pos_x_pixels, |
| 42 jfloat raw_pos_y_pixels); | 42 jfloat raw_pos_y_pixels, |
| 43 jint android_tool_type_0, |
| 44 jint android_tool_type_1, |
| 45 jint android_button_state); |
| 43 virtual ~MotionEventAndroid(); | 46 virtual ~MotionEventAndroid(); |
| 44 | 47 |
| 45 // ui::MotionEvent methods. | 48 // ui::MotionEvent methods. |
| 46 virtual int GetId() const OVERRIDE; | 49 virtual int GetId() const OVERRIDE; |
| 47 virtual Action GetAction() const OVERRIDE; | 50 virtual Action GetAction() const OVERRIDE; |
| 48 virtual int GetActionIndex() const OVERRIDE; | 51 virtual int GetActionIndex() const OVERRIDE; |
| 49 virtual size_t GetPointerCount() const OVERRIDE; | 52 virtual size_t GetPointerCount() const OVERRIDE; |
| 50 virtual int GetPointerId(size_t pointer_index) const OVERRIDE; | 53 virtual int GetPointerId(size_t pointer_index) const OVERRIDE; |
| 51 virtual float GetX(size_t pointer_index) const OVERRIDE; | 54 virtual float GetX(size_t pointer_index) const OVERRIDE; |
| 52 virtual float GetY(size_t pointer_index) const OVERRIDE; | 55 virtual float GetY(size_t pointer_index) const OVERRIDE; |
| 53 virtual float GetRawX(size_t pointer_index) const OVERRIDE; | 56 virtual float GetRawX(size_t pointer_index) const OVERRIDE; |
| 54 virtual float GetRawY(size_t pointer_index) const OVERRIDE; | 57 virtual float GetRawY(size_t pointer_index) const OVERRIDE; |
| 55 virtual float GetTouchMajor(size_t pointer_index) const OVERRIDE; | 58 virtual float GetTouchMajor(size_t pointer_index) const OVERRIDE; |
| 56 virtual float GetPressure(size_t pointer_index) const OVERRIDE; | 59 virtual float GetPressure(size_t pointer_index) const OVERRIDE; |
| 57 virtual base::TimeTicks GetEventTime() const OVERRIDE; | 60 virtual base::TimeTicks GetEventTime() const OVERRIDE; |
| 58 virtual size_t GetHistorySize() const OVERRIDE; | 61 virtual size_t GetHistorySize() const OVERRIDE; |
| 59 virtual base::TimeTicks GetHistoricalEventTime( | 62 virtual base::TimeTicks GetHistoricalEventTime( |
| 60 size_t historical_index) const OVERRIDE; | 63 size_t historical_index) const OVERRIDE; |
| 61 virtual float GetHistoricalTouchMajor(size_t pointer_index, | 64 virtual float GetHistoricalTouchMajor(size_t pointer_index, |
| 62 size_t historical_index) const OVERRIDE; | 65 size_t historical_index) const OVERRIDE; |
| 63 virtual float GetHistoricalX(size_t pointer_index, | 66 virtual float GetHistoricalX(size_t pointer_index, |
| 64 size_t historical_index) const OVERRIDE; | 67 size_t historical_index) const OVERRIDE; |
| 65 virtual float GetHistoricalY(size_t pointer_index, | 68 virtual float GetHistoricalY(size_t pointer_index, |
| 66 size_t historical_index) const OVERRIDE; | 69 size_t historical_index) const OVERRIDE; |
| 70 virtual ToolType GetToolType(size_t pointer_index) const OVERRIDE; |
| 71 virtual int GetButtonState() const OVERRIDE; |
| 67 virtual scoped_ptr<MotionEvent> Clone() const OVERRIDE; | 72 virtual scoped_ptr<MotionEvent> Clone() const OVERRIDE; |
| 68 virtual scoped_ptr<MotionEvent> Cancel() const OVERRIDE; | 73 virtual scoped_ptr<MotionEvent> Cancel() const OVERRIDE; |
| 69 | 74 |
| 70 // Additional Android MotionEvent methods. | 75 // Additional Android MotionEvent methods. |
| 71 float GetTouchMinor() const { return GetTouchMinor(0); } | 76 float GetTouchMinor() const { return GetTouchMinor(0); } |
| 72 float GetTouchMinor(size_t pointer_index) const; | 77 float GetTouchMinor(size_t pointer_index) const; |
| 73 float GetOrientation() const; | 78 float GetOrientation() const; |
| 74 base::TimeTicks GetDownTime() const; | 79 base::TimeTicks GetDownTime() const; |
| 75 | 80 |
| 76 static bool RegisterMotionEventAndroid(JNIEnv* env); | 81 static bool RegisterMotionEventAndroid(JNIEnv* env); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 103 | 108 |
| 104 base::TimeTicks cached_time_; | 109 base::TimeTicks cached_time_; |
| 105 Action cached_action_; | 110 Action cached_action_; |
| 106 size_t cached_pointer_count_; | 111 size_t cached_pointer_count_; |
| 107 size_t cached_history_size_; | 112 size_t cached_history_size_; |
| 108 int cached_action_index_; | 113 int cached_action_index_; |
| 109 gfx::PointF cached_positions_[MAX_POINTERS_TO_CACHE]; | 114 gfx::PointF cached_positions_[MAX_POINTERS_TO_CACHE]; |
| 110 int cached_pointer_ids_[MAX_POINTERS_TO_CACHE]; | 115 int cached_pointer_ids_[MAX_POINTERS_TO_CACHE]; |
| 111 float cached_touch_majors_[MAX_POINTERS_TO_CACHE]; | 116 float cached_touch_majors_[MAX_POINTERS_TO_CACHE]; |
| 112 gfx::Vector2dF cached_raw_position_offset_; | 117 gfx::Vector2dF cached_raw_position_offset_; |
| 118 ToolType cached_tool_types_[MAX_POINTERS_TO_CACHE]; |
| 119 int cached_button_state_; |
| 113 | 120 |
| 114 // Used to convert pixel coordinates from the Java-backed MotionEvent to | 121 // Used to convert pixel coordinates from the Java-backed MotionEvent to |
| 115 // DIP coordinates cached/returned by the MotionEventAndroid. | 122 // DIP coordinates cached/returned by the MotionEventAndroid. |
| 116 const float pix_to_dip_; | 123 const float pix_to_dip_; |
| 117 | 124 |
| 118 // Whether |event_| should be recycled on destruction. This will only be true | 125 // Whether |event_| should be recycled on destruction. This will only be true |
| 119 // for those events generated via |Obtain(...)|. | 126 // for those events generated via |Obtain(...)|. |
| 120 bool should_recycle_; | 127 bool should_recycle_; |
| 121 }; | 128 }; |
| 122 | 129 |
| 123 } // namespace content | 130 } // namespace content |
| 124 | 131 |
| 125 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_MOTION_EVENT_ANDROID_H_ | 132 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_MOTION_EVENT_ANDROID_H_ |
| OLD | NEW |