| 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 25 matching lines...) Expand all Loading... |
| 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, | 43 jint android_tool_type_0, |
| 44 jint android_tool_type_1, | 44 jint android_tool_type_1, |
| 45 jint android_button_state); | 45 jint android_button_state); |
| 46 MotionEventAndroid(float pix_to_dip, |
| 47 JNIEnv* env, |
| 48 jobject event, |
| 49 bool should_recycle); |
| 46 virtual ~MotionEventAndroid(); | 50 virtual ~MotionEventAndroid(); |
| 47 | 51 |
| 48 // ui::MotionEvent methods. | 52 // ui::MotionEvent methods. |
| 49 virtual int GetId() const OVERRIDE; | 53 virtual int GetId() const OVERRIDE; |
| 50 virtual Action GetAction() const OVERRIDE; | 54 virtual Action GetAction() const OVERRIDE; |
| 51 virtual int GetActionIndex() const OVERRIDE; | 55 virtual int GetActionIndex() const OVERRIDE; |
| 52 virtual size_t GetPointerCount() const OVERRIDE; | 56 virtual size_t GetPointerCount() const OVERRIDE; |
| 53 virtual int GetPointerId(size_t pointer_index) const OVERRIDE; | 57 virtual int GetPointerId(size_t pointer_index) const OVERRIDE; |
| 54 virtual float GetX(size_t pointer_index) const OVERRIDE; | 58 virtual float GetX(size_t pointer_index) const OVERRIDE; |
| 55 virtual float GetY(size_t pointer_index) const OVERRIDE; | 59 virtual float GetY(size_t pointer_index) const OVERRIDE; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 84 const MotionEventAndroid& event); | 88 const MotionEventAndroid& event); |
| 85 static base::android::ScopedJavaLocalRef<jobject> Obtain( | 89 static base::android::ScopedJavaLocalRef<jobject> Obtain( |
| 86 base::TimeTicks down_time, | 90 base::TimeTicks down_time, |
| 87 base::TimeTicks event_time, | 91 base::TimeTicks event_time, |
| 88 Action action, | 92 Action action, |
| 89 float x_pixels, | 93 float x_pixels, |
| 90 float y_pixels); | 94 float y_pixels); |
| 91 | 95 |
| 92 private: | 96 private: |
| 93 MotionEventAndroid(); | 97 MotionEventAndroid(); |
| 94 MotionEventAndroid(float pix_to_dip, JNIEnv* env, jobject event); | |
| 95 MotionEventAndroid(const MotionEventAndroid&); | 98 MotionEventAndroid(const MotionEventAndroid&); |
| 96 MotionEventAndroid& operator=(const MotionEventAndroid&); | 99 MotionEventAndroid& operator=(const MotionEventAndroid&); |
| 97 | 100 |
| 98 float ToDips(float pixels) const; | 101 float ToDips(float pixels) const; |
| 99 gfx::PointF ToDips(const gfx::PointF& pixels) const; | 102 gfx::PointF ToDips(const gfx::PointF& pixels) const; |
| 100 | 103 |
| 101 // Cache pointer coords, id's and major lengths for the most common | 104 // Cache pointer coords, id's and major lengths for the most common |
| 102 // touch-related scenarios, i.e., scrolling and pinching. This prevents | 105 // touch-related scenarios, i.e., scrolling and pinching. This prevents |
| 103 // redundant JNI fetches for the same bits. | 106 // redundant JNI fetches for the same bits. |
| 104 enum { MAX_POINTERS_TO_CACHE = 2 }; | 107 enum { MAX_POINTERS_TO_CACHE = 2 }; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 123 const float pix_to_dip_; | 126 const float pix_to_dip_; |
| 124 | 127 |
| 125 // Whether |event_| should be recycled on destruction. This will only be true | 128 // Whether |event_| should be recycled on destruction. This will only be true |
| 126 // for those events generated via |Obtain(...)|. | 129 // for those events generated via |Obtain(...)|. |
| 127 bool should_recycle_; | 130 bool should_recycle_; |
| 128 }; | 131 }; |
| 129 | 132 |
| 130 } // namespace content | 133 } // namespace content |
| 131 | 134 |
| 132 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_MOTION_EVENT_ANDROID_H_ | 135 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_MOTION_EVENT_ANDROID_H_ |
| OLD | NEW |