OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "content/browser/renderer_host/input/synthetic_gesture_target_android.h
" | 5 #include "content/browser/renderer_host/input/synthetic_gesture_target_android.h
" |
6 | 6 |
7 #include "content/browser/android/content_view_core_impl.h" | 7 #include "content/browser/android/content_view_core_impl.h" |
8 #include "content/browser/renderer_host/render_widget_host_impl.h" | 8 #include "content/browser/renderer_host/render_widget_host_impl.h" |
9 #include "jni/MotionEventSynthesizer_jni.h" | 9 #include "jni/MotionEventSynthesizer_jni.h" |
10 #include "third_party/WebKit/public/web/WebInputEvent.h" | 10 #include "third_party/WebKit/public/web/WebInputEvent.h" |
11 #include "ui/gfx/android/view_configuration.h" | 11 #include "ui/gfx/android/view_configuration.h" |
12 | 12 |
13 using blink::WebTouchEvent; | 13 using blink::WebTouchEvent; |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 | 16 |
17 SyntheticGestureTargetAndroid::SyntheticGestureTargetAndroid( | 17 SyntheticGestureTargetAndroid::SyntheticGestureTargetAndroid( |
18 RenderWidgetHostImpl* host, | 18 RenderWidgetHostImpl* host, |
19 base::android::ScopedJavaLocalRef<jobject> touch_event_synthesizer) | 19 base::android::ScopedJavaLocalRef<jobject> touch_event_synthesizer) |
20 : SyntheticGestureTargetBase(host), | 20 : SyntheticGestureTargetBase(host), |
21 touch_event_synthesizer_(touch_event_synthesizer) { | 21 touch_event_synthesizer_(touch_event_synthesizer) { |
22 DCHECK(!touch_event_synthesizer_.is_null()); | 22 DCHECK(!touch_event_synthesizer_.is_null()); |
23 } | 23 } |
24 | 24 |
25 SyntheticGestureTargetAndroid::~SyntheticGestureTargetAndroid() { | 25 SyntheticGestureTargetAndroid::~SyntheticGestureTargetAndroid() { |
26 } | 26 } |
27 | 27 |
28 bool SyntheticGestureTargetAndroid::RegisterMotionEventSynthesizer( | |
29 JNIEnv* env) { | |
30 return RegisterNativesImpl(env); | |
31 } | |
32 | |
33 void SyntheticGestureTargetAndroid::TouchSetPointer( | 28 void SyntheticGestureTargetAndroid::TouchSetPointer( |
34 JNIEnv* env, int index, int x, int y, int id) { | 29 JNIEnv* env, int index, int x, int y, int id) { |
35 TRACE_EVENT0("input", "SyntheticGestureTargetAndroid::TouchSetPointer"); | 30 TRACE_EVENT0("input", "SyntheticGestureTargetAndroid::TouchSetPointer"); |
36 Java_MotionEventSynthesizer_setPointer(env, touch_event_synthesizer_.obj(), | 31 Java_MotionEventSynthesizer_setPointer(env, touch_event_synthesizer_.obj(), |
37 index, x, y, id); | 32 index, x, y, id); |
38 } | 33 } |
39 | 34 |
40 void SyntheticGestureTargetAndroid::TouchSetScrollDeltas( | 35 void SyntheticGestureTargetAndroid::TouchSetScrollDeltas( |
41 JNIEnv* env, int x, int y, int dx, int dy) { | 36 JNIEnv* env, int x, int y, int dx, int dy) { |
42 TRACE_EVENT0("input", "SyntheticGestureTargetAndroid::TouchSetPointer"); | 37 TRACE_EVENT0("input", "SyntheticGestureTargetAndroid::TouchSetPointer"); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 return gfx::ViewConfiguration::GetTouchSlopInDips(); | 108 return gfx::ViewConfiguration::GetTouchSlopInDips(); |
114 } | 109 } |
115 | 110 |
116 float SyntheticGestureTargetAndroid::GetMinScalingSpanInDips() const { | 111 float SyntheticGestureTargetAndroid::GetMinScalingSpanInDips() const { |
117 // TODO(jdduke): Have all targets use the same ui::GestureConfiguration | 112 // TODO(jdduke): Have all targets use the same ui::GestureConfiguration |
118 // codepath. | 113 // codepath. |
119 return gfx::ViewConfiguration::GetMinScalingSpanInDips(); | 114 return gfx::ViewConfiguration::GetMinScalingSpanInDips(); |
120 } | 115 } |
121 | 116 |
122 } // namespace content | 117 } // namespace content |
OLD | NEW |