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 10 matching lines...) Expand all Loading... |
21 virtual ~MotionEventAndroid(); | 21 virtual ~MotionEventAndroid(); |
22 | 22 |
23 // ui::MotionEvent methods. | 23 // ui::MotionEvent methods. |
24 virtual Action GetAction() const OVERRIDE; | 24 virtual Action GetAction() const OVERRIDE; |
25 virtual int GetActionIndex() const OVERRIDE; | 25 virtual int GetActionIndex() const OVERRIDE; |
26 virtual size_t GetPointerCount() const OVERRIDE; | 26 virtual size_t GetPointerCount() const OVERRIDE; |
27 virtual int GetPointerId(size_t pointer_index) const OVERRIDE; | 27 virtual int GetPointerId(size_t pointer_index) const OVERRIDE; |
28 virtual float GetX(size_t pointer_index) const OVERRIDE; | 28 virtual float GetX(size_t pointer_index) const OVERRIDE; |
29 virtual float GetY(size_t pointer_index) const OVERRIDE; | 29 virtual float GetY(size_t pointer_index) const OVERRIDE; |
30 virtual float GetTouchMajor(size_t pointer_index) const OVERRIDE; | 30 virtual float GetTouchMajor(size_t pointer_index) const OVERRIDE; |
| 31 virtual float GetPressure(size_t pointer_index) const OVERRIDE; |
31 virtual base::TimeTicks GetEventTime() const OVERRIDE; | 32 virtual base::TimeTicks GetEventTime() const OVERRIDE; |
32 virtual size_t GetHistorySize() const OVERRIDE; | 33 virtual size_t GetHistorySize() const OVERRIDE; |
33 virtual base::TimeTicks GetHistoricalEventTime( | 34 virtual base::TimeTicks GetHistoricalEventTime( |
34 size_t historical_index) const OVERRIDE; | 35 size_t historical_index) const OVERRIDE; |
35 virtual float GetHistoricalTouchMajor( | 36 virtual float GetHistoricalTouchMajor( |
36 size_t pointer_index, | 37 size_t pointer_index, |
37 size_t historical_index) const OVERRIDE; | 38 size_t historical_index) const OVERRIDE; |
38 virtual float GetHistoricalX( | 39 virtual float GetHistoricalX( |
39 size_t pointer_index, | 40 size_t pointer_index, |
40 size_t historical_index) const OVERRIDE; | 41 size_t historical_index) const OVERRIDE; |
41 virtual float GetHistoricalY( | 42 virtual float GetHistoricalY( |
42 size_t pointer_index, | 43 size_t pointer_index, |
43 size_t historical_index) const OVERRIDE; | 44 size_t historical_index) const OVERRIDE; |
44 virtual scoped_ptr<MotionEvent> Clone() const OVERRIDE; | 45 virtual scoped_ptr<MotionEvent> Clone() const OVERRIDE; |
45 virtual scoped_ptr<MotionEvent> Cancel() const OVERRIDE; | 46 virtual scoped_ptr<MotionEvent> Cancel() const OVERRIDE; |
46 | 47 |
47 // Additional Android MotionEvent methods. | 48 // Additional Android MotionEvent methods. |
48 float GetPressure() const { return GetPressure(0); } | |
49 float GetPressure(size_t pointer_index) const; | |
50 float GetTouchMinor() const { return GetTouchMinor(0); } | 49 float GetTouchMinor() const { return GetTouchMinor(0); } |
51 float GetTouchMinor(size_t pointer_index) const; | 50 float GetTouchMinor(size_t pointer_index) const; |
52 float GetOrientation() const; | 51 float GetOrientation() const; |
53 base::TimeTicks GetDownTime() const; | 52 base::TimeTicks GetDownTime() const; |
54 | 53 |
55 static bool RegisterMotionEventAndroid(JNIEnv* env); | 54 static bool RegisterMotionEventAndroid(JNIEnv* env); |
56 | 55 |
57 static base::android::ScopedJavaLocalRef<jobject> Obtain( | 56 static base::android::ScopedJavaLocalRef<jobject> Obtain( |
58 const MotionEventAndroid& event); | 57 const MotionEventAndroid& event); |
59 static base::android::ScopedJavaLocalRef<jobject> Obtain( | 58 static base::android::ScopedJavaLocalRef<jobject> Obtain( |
60 base::TimeTicks down_time, | 59 base::TimeTicks down_time, |
61 base::TimeTicks event_time, | 60 base::TimeTicks event_time, |
62 Action action, | 61 Action action, |
63 float x, | 62 float x, |
64 float y); | 63 float y); |
65 | 64 |
66 private: | 65 private: |
67 MotionEventAndroid(const MotionEventAndroid& other, bool clone); | 66 MotionEventAndroid(); |
| 67 MotionEventAndroid(const MotionEventAndroid&); |
| 68 MotionEventAndroid& operator=(const MotionEventAndroid&); |
68 | 69 |
69 // The Java reference to the underlying MotionEvent. | 70 // The Java reference to the underlying MotionEvent. |
70 base::android::ScopedJavaGlobalRef<jobject> event_; | 71 base::android::ScopedJavaGlobalRef<jobject> event_; |
71 | 72 |
72 base::TimeTicks cached_time_; | 73 base::TimeTicks cached_time_; |
73 Action cached_action_; | 74 Action cached_action_; |
74 size_t cached_pointer_count_; | 75 size_t cached_pointer_count_; |
75 size_t cached_history_size_; | 76 size_t cached_history_size_; |
76 int cached_action_index_; | 77 int cached_action_index_; |
77 float cached_x_; | 78 float cached_x_; |
78 float cached_y_; | 79 float cached_y_; |
79 | 80 |
80 // Whether |event_| should be recycled on destruction. This will only be true | 81 // Whether |event_| should be recycled on destruction. This will only be true |
81 // for those events generated via |Obtain(...)|. | 82 // for those events generated via |Obtain(...)|. |
82 bool should_recycle_; | 83 bool should_recycle_; |
83 | |
84 DISALLOW_COPY_AND_ASSIGN(MotionEventAndroid); | |
85 }; | 84 }; |
86 | 85 |
87 } // namespace content | 86 } // namespace content |
88 | 87 |
89 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_MOTION_EVENT_ANDROID_H_ | 88 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_MOTION_EVENT_ANDROID_H_ |
OLD | NEW |