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/platform/WebInputEvent.h" | 10 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 TouchSetPointer(env, i, point->position.x, point->position.y, point->id); | 77 TouchSetPointer(env, i, point->position.x, point->position.y, point->id); |
78 } | 78 } |
79 | 79 |
80 TouchInject(env, action, num_touches, | 80 TouchInject(env, action, num_touches, |
81 static_cast<int64_t>(web_touch.timeStampSeconds() * 1000.0)); | 81 static_cast<int64_t>(web_touch.timeStampSeconds() * 1000.0)); |
82 } | 82 } |
83 | 83 |
84 void SyntheticGestureTargetAndroid::DispatchWebMouseWheelEventToPlatform( | 84 void SyntheticGestureTargetAndroid::DispatchWebMouseWheelEventToPlatform( |
85 const blink::WebMouseWheelEvent& web_wheel, const ui::LatencyInfo&) { | 85 const blink::WebMouseWheelEvent& web_wheel, const ui::LatencyInfo&) { |
86 JNIEnv* env = base::android::AttachCurrentThread(); | 86 JNIEnv* env = base::android::AttachCurrentThread(); |
87 TouchSetScrollDeltas(env, web_wheel.x, web_wheel.y, web_wheel.deltaX, | 87 TouchSetScrollDeltas(env, web_wheel.position.x, web_wheel.position.y, |
88 web_wheel.deltaY); | 88 web_wheel.deltaX, web_wheel.deltaY); |
89 Java_MotionEventSynthesizer_inject( | 89 Java_MotionEventSynthesizer_inject( |
90 env, touch_event_synthesizer_, | 90 env, touch_event_synthesizer_, |
91 static_cast<int>(SyntheticGestureTargetAndroid::ActionScroll), 1, | 91 static_cast<int>(SyntheticGestureTargetAndroid::ActionScroll), 1, |
92 static_cast<int64_t>(web_wheel.timeStampSeconds() * 1000.0)); | 92 static_cast<int64_t>(web_wheel.timeStampSeconds() * 1000.0)); |
93 } | 93 } |
94 | 94 |
95 void SyntheticGestureTargetAndroid::DispatchWebMouseEventToPlatform( | 95 void SyntheticGestureTargetAndroid::DispatchWebMouseEventToPlatform( |
96 const blink::WebMouseEvent& web_mouse, const ui::LatencyInfo&) { | 96 const blink::WebMouseEvent& web_mouse, const ui::LatencyInfo&) { |
97 CHECK(false); | 97 CHECK(false); |
98 } | 98 } |
99 | 99 |
100 SyntheticGestureParams::GestureSourceType | 100 SyntheticGestureParams::GestureSourceType |
101 SyntheticGestureTargetAndroid::GetDefaultSyntheticGestureSourceType() const { | 101 SyntheticGestureTargetAndroid::GetDefaultSyntheticGestureSourceType() const { |
102 return SyntheticGestureParams::TOUCH_INPUT; | 102 return SyntheticGestureParams::TOUCH_INPUT; |
103 } | 103 } |
104 | 104 |
105 float SyntheticGestureTargetAndroid::GetTouchSlopInDips() const { | 105 float SyntheticGestureTargetAndroid::GetTouchSlopInDips() const { |
106 // TODO(jdduke): Have all targets use the same ui::GestureConfiguration | 106 // TODO(jdduke): Have all targets use the same ui::GestureConfiguration |
107 // codepath. | 107 // codepath. |
108 return gfx::ViewConfiguration::GetTouchSlopInDips(); | 108 return gfx::ViewConfiguration::GetTouchSlopInDips(); |
109 } | 109 } |
110 | 110 |
111 float SyntheticGestureTargetAndroid::GetMinScalingSpanInDips() const { | 111 float SyntheticGestureTargetAndroid::GetMinScalingSpanInDips() const { |
112 // TODO(jdduke): Have all targets use the same ui::GestureConfiguration | 112 // TODO(jdduke): Have all targets use the same ui::GestureConfiguration |
113 // codepath. | 113 // codepath. |
114 return gfx::ViewConfiguration::GetMinScalingSpanInDips(); | 114 return gfx::ViewConfiguration::GetMinScalingSpanInDips(); |
115 } | 115 } |
116 | 116 |
117 } // namespace content | 117 } // namespace content |
OLD | NEW |