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 UI_EVENTS_ANDROID_MOTION_EVENT_ANDROID_H_ | 6 #ifndef UI_EVENTS_ANDROID_MOTION_EVENT_ANDROID_H_ |
7 #define UI_EVENTS_ANDROID_MOTION_EVENT_ANDROID_H_ | 7 #define UI_EVENTS_ANDROID_MOTION_EVENT_ANDROID_H_ |
8 | 8 |
9 #include <jni.h> | 9 #include <jni.h> |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 float GetHistoricalTouchMajor(size_t pointer_index, | 85 float GetHistoricalTouchMajor(size_t pointer_index, |
86 size_t historical_index) const override; | 86 size_t historical_index) const override; |
87 float GetHistoricalX(size_t pointer_index, | 87 float GetHistoricalX(size_t pointer_index, |
88 size_t historical_index) const override; | 88 size_t historical_index) const override; |
89 float GetHistoricalY(size_t pointer_index, | 89 float GetHistoricalY(size_t pointer_index, |
90 size_t historical_index) const override; | 90 size_t historical_index) const override; |
91 ToolType GetToolType(size_t pointer_index) const override; | 91 ToolType GetToolType(size_t pointer_index) const override; |
92 int GetButtonState() const override; | 92 int GetButtonState() const override; |
93 int GetFlags() const override; | 93 int GetFlags() const override; |
94 | 94 |
95 static bool RegisterMotionEventAndroid(JNIEnv* env); | |
96 | |
97 private: | 95 private: |
98 struct CachedPointer; | 96 struct CachedPointer; |
99 | 97 |
100 float ToDips(float pixels) const; | 98 float ToDips(float pixels) const; |
101 CachedPointer FromAndroidPointer(const Pointer& pointer) const; | 99 CachedPointer FromAndroidPointer(const Pointer& pointer) const; |
102 | 100 |
103 // Cache pointer coords, id's and major lengths for the most common | 101 // Cache pointer coords, id's and major lengths for the most common |
104 // touch-related scenarios, i.e., scrolling and pinching. This prevents | 102 // touch-related scenarios, i.e., scrolling and pinching. This prevents |
105 // redundant JNI fetches for the same bits. | 103 // redundant JNI fetches for the same bits. |
106 enum { MAX_POINTERS_TO_CACHE = 2 }; | 104 enum { MAX_POINTERS_TO_CACHE = 2 }; |
(...skipping 26 matching lines...) Expand all Loading... |
133 | 131 |
134 // A unique identifier for the Android motion event. | 132 // A unique identifier for the Android motion event. |
135 const uint32_t unique_event_id_; | 133 const uint32_t unique_event_id_; |
136 | 134 |
137 DISALLOW_COPY_AND_ASSIGN(MotionEventAndroid); | 135 DISALLOW_COPY_AND_ASSIGN(MotionEventAndroid); |
138 }; | 136 }; |
139 | 137 |
140 } // namespace content | 138 } // namespace content |
141 | 139 |
142 #endif // UI_EVENTS_ANDROID_MOTION_EVENT_ANDROID_H_ | 140 #endif // UI_EVENTS_ANDROID_MOTION_EVENT_ANDROID_H_ |
OLD | NEW |