| 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" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 break; | 71 break; |
| 72 case blink::WebInputEvent::TouchEnd: | 72 case blink::WebInputEvent::TouchEnd: |
| 73 action = SyntheticGestureTargetAndroid::ActionEnd; | 73 action = SyntheticGestureTargetAndroid::ActionEnd; |
| 74 break; | 74 break; |
| 75 default: | 75 default: |
| 76 NOTREACHED(); | 76 NOTREACHED(); |
| 77 } | 77 } |
| 78 const unsigned num_touches = web_touch.touchesLength; | 78 const unsigned num_touches = web_touch.touchesLength; |
| 79 for (unsigned i = 0; i < num_touches; ++i) { | 79 for (unsigned i = 0; i < num_touches; ++i) { |
| 80 const blink::WebTouchPoint* point = &web_touch.touches[i]; | 80 const blink::WebTouchPoint* point = &web_touch.touches[i]; |
| 81 TouchSetPointer(env, i, point->position.x, point->position.y, point->id); | 81 TouchSetPointer(env, i, point->position.x, point->position.y, |
| 82 point->pointerId); |
| 82 } | 83 } |
| 83 | 84 |
| 84 TouchInject(env, action, num_touches, | 85 TouchInject(env, action, num_touches, |
| 85 static_cast<int64>(web_touch.timeStampSeconds * 1000.0)); | 86 static_cast<int64>(web_touch.timeStampSeconds * 1000.0)); |
| 86 } | 87 } |
| 87 | 88 |
| 88 void SyntheticGestureTargetAndroid::DispatchWebMouseWheelEventToPlatform( | 89 void SyntheticGestureTargetAndroid::DispatchWebMouseWheelEventToPlatform( |
| 89 const blink::WebMouseWheelEvent& web_wheel, const ui::LatencyInfo&) { | 90 const blink::WebMouseWheelEvent& web_wheel, const ui::LatencyInfo&) { |
| 90 JNIEnv* env = base::android::AttachCurrentThread(); | 91 JNIEnv* env = base::android::AttachCurrentThread(); |
| 91 TouchSetScrollDeltas(env, web_wheel.x, web_wheel.y, web_wheel.deltaX, | 92 TouchSetScrollDeltas(env, web_wheel.x, web_wheel.y, web_wheel.deltaX, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 113 } | 114 } |
| 114 | 115 |
| 115 float SyntheticGestureTargetAndroid::GetMinScalingSpanInDips() const { | 116 float SyntheticGestureTargetAndroid::GetMinScalingSpanInDips() const { |
| 116 float device_scale_factor = | 117 float device_scale_factor = |
| 117 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().device_scale_factor(); | 118 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().device_scale_factor(); |
| 118 return | 119 return |
| 119 gfx::ViewConfiguration::GetMinScalingSpanInPixels() / device_scale_factor; | 120 gfx::ViewConfiguration::GetMinScalingSpanInPixels() / device_scale_factor; |
| 120 } | 121 } |
| 121 | 122 |
| 122 } // namespace content | 123 } // namespace content |
| OLD | NEW |