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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 Action GetAction() const override; | 62 Action GetAction() const override; |
63 int GetActionIndex() const override; | 63 int GetActionIndex() const override; |
64 size_t GetPointerCount() const override; | 64 size_t GetPointerCount() const override; |
65 int GetPointerId(size_t pointer_index) const override; | 65 int GetPointerId(size_t pointer_index) const override; |
66 float GetX(size_t pointer_index) const override; | 66 float GetX(size_t pointer_index) const override; |
67 float GetY(size_t pointer_index) const override; | 67 float GetY(size_t pointer_index) const override; |
68 float GetRawX(size_t pointer_index) const override; | 68 float GetRawX(size_t pointer_index) const override; |
69 float GetRawY(size_t pointer_index) const override; | 69 float GetRawY(size_t pointer_index) const override; |
70 float GetTouchMajor(size_t pointer_index) const override; | 70 float GetTouchMajor(size_t pointer_index) const override; |
71 float GetTouchMinor(size_t pointer_index) const override; | 71 float GetTouchMinor(size_t pointer_index) const override; |
72 float GetOrientation(size_t pointer_index) const override; | 72 float GetTouchOrientation(size_t pointer_index) const override; |
73 float GetPressure(size_t pointer_index) const override; | 73 float GetPressure(size_t pointer_index) const override; |
74 base::TimeTicks GetEventTime() const override; | 74 base::TimeTicks GetEventTime() const override; |
75 size_t GetHistorySize() const override; | 75 size_t GetHistorySize() const override; |
76 base::TimeTicks GetHistoricalEventTime( | 76 base::TimeTicks GetHistoricalEventTime( |
77 size_t historical_index) const override; | 77 size_t historical_index) const override; |
78 float GetHistoricalTouchMajor(size_t pointer_index, | 78 float GetHistoricalTouchMajor(size_t pointer_index, |
79 size_t historical_index) const override; | 79 size_t historical_index) const override; |
80 float GetHistoricalX(size_t pointer_index, | 80 float GetHistoricalX(size_t pointer_index, |
81 size_t historical_index) const override; | 81 size_t historical_index) const override; |
82 float GetHistoricalY(size_t pointer_index, | 82 float GetHistoricalY(size_t pointer_index, |
83 size_t historical_index) const override; | 83 size_t historical_index) const override; |
84 ToolType GetToolType(size_t pointer_index) const override; | 84 ToolType GetToolType(size_t pointer_index) const override; |
85 int GetButtonState() const override; | 85 int GetButtonState() const override; |
86 int GetFlags() const override; | 86 int GetFlags() const override; |
87 | 87 |
88 static bool RegisterMotionEventAndroid(JNIEnv* env); | 88 static bool RegisterMotionEventAndroid(JNIEnv* env); |
89 | 89 |
90 private: | 90 private: |
91 struct CachedPointer; | 91 struct CachedPointer; |
92 | 92 |
93 float GetOrientation(size_t pointer_index) const; | |
USE eero AT chromium.org
2015/05/27 08:43:49
I keep this as a separate function as it is useful
| |
93 float ToDips(float pixels) const; | 94 float ToDips(float pixels) const; |
94 CachedPointer FromAndroidPointer(const Pointer& pointer) const; | 95 CachedPointer FromAndroidPointer(const Pointer& pointer) const; |
95 | 96 |
96 // Cache pointer coords, id's and major lengths for the most common | 97 // Cache pointer coords, id's and major lengths for the most common |
97 // touch-related scenarios, i.e., scrolling and pinching. This prevents | 98 // touch-related scenarios, i.e., scrolling and pinching. This prevents |
98 // redundant JNI fetches for the same bits. | 99 // redundant JNI fetches for the same bits. |
99 enum { MAX_POINTERS_TO_CACHE = 2 }; | 100 enum { MAX_POINTERS_TO_CACHE = 2 }; |
100 | 101 |
101 // The Java reference to the underlying MotionEvent. | 102 // The Java reference to the underlying MotionEvent. |
102 base::android::ScopedJavaGlobalRef<jobject> event_; | 103 base::android::ScopedJavaGlobalRef<jobject> event_; |
(...skipping 22 matching lines...) Expand all Loading... | |
125 | 126 |
126 // A unique identifier for the Android motion event. | 127 // A unique identifier for the Android motion event. |
127 const uint32 unique_event_id_; | 128 const uint32 unique_event_id_; |
128 | 129 |
129 DISALLOW_COPY_AND_ASSIGN(MotionEventAndroid); | 130 DISALLOW_COPY_AND_ASSIGN(MotionEventAndroid); |
130 }; | 131 }; |
131 | 132 |
132 } // namespace content | 133 } // namespace content |
133 | 134 |
134 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_MOTION_EVENT_ANDROID_H_ | 135 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_MOTION_EVENT_ANDROID_H_ |
OLD | NEW |