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/TouchEventSynthesizer_jni.h" | 9 #include "jni/TouchEventSynthesizer_jni.h" |
10 #include "third_party/WebKit/public/web/WebInputEvent.h" | 10 #include "third_party/WebKit/public/web/WebInputEvent.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 SyntheticGestureTargetAndroid::~SyntheticGestureTargetAndroid() { | 26 SyntheticGestureTargetAndroid::~SyntheticGestureTargetAndroid() { |
27 } | 27 } |
28 | 28 |
29 bool SyntheticGestureTargetAndroid::RegisterTouchEventSynthesizer(JNIEnv* env) { | 29 bool SyntheticGestureTargetAndroid::RegisterTouchEventSynthesizer(JNIEnv* env) { |
30 return RegisterNativesImpl(env); | 30 return RegisterNativesImpl(env); |
31 } | 31 } |
32 | 32 |
33 void SyntheticGestureTargetAndroid::TouchSetPointer( | 33 void SyntheticGestureTargetAndroid::TouchSetPointer( |
34 JNIEnv* env, int index, int x, int y, int id) { | 34 JNIEnv* env, int index, int x, int y, int id) { |
35 TRACE_EVENT0("benchmark", "SyntheticGestureTargetAndroid::TouchSetPointer"); | 35 TRACE_EVENT0("input", "SyntheticGestureTargetAndroid::TouchSetPointer"); |
36 Java_TouchEventSynthesizer_setPointer(env, touch_event_synthesizer_.obj(), | 36 Java_TouchEventSynthesizer_setPointer(env, touch_event_synthesizer_.obj(), |
37 index, x, y, id); | 37 index, x, y, id); |
38 } | 38 } |
39 | 39 |
40 void SyntheticGestureTargetAndroid::TouchInject( | 40 void SyntheticGestureTargetAndroid::TouchInject( |
41 JNIEnv* env, Action action, int pointer_count, int64 time_in_ms) { | 41 JNIEnv* env, Action action, int pointer_count, int64 time_in_ms) { |
42 TRACE_EVENT0("benchmark", "SyntheticGestureTargetAndroid::TouchInject"); | 42 TRACE_EVENT0("input", "SyntheticGestureTargetAndroid::TouchInject"); |
43 Java_TouchEventSynthesizer_inject(env, touch_event_synthesizer_.obj(), | 43 Java_TouchEventSynthesizer_inject(env, touch_event_synthesizer_.obj(), |
44 static_cast<int>(action), pointer_count, | 44 static_cast<int>(action), pointer_count, |
45 time_in_ms); | 45 time_in_ms); |
46 } | 46 } |
47 | 47 |
48 void SyntheticGestureTargetAndroid::DispatchWebTouchEventToPlatform( | 48 void SyntheticGestureTargetAndroid::DispatchWebTouchEventToPlatform( |
49 const blink::WebTouchEvent& web_touch, const ui::LatencyInfo&) { | 49 const blink::WebTouchEvent& web_touch, const ui::LatencyInfo&) { |
50 JNIEnv* env = base::android::AttachCurrentThread(); | 50 JNIEnv* env = base::android::AttachCurrentThread(); |
51 | 51 |
52 SyntheticGestureTargetAndroid::Action action = | 52 SyntheticGestureTargetAndroid::Action action = |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 return gesture_source_type == SyntheticGestureParams::TOUCH_INPUT; | 87 return gesture_source_type == SyntheticGestureParams::TOUCH_INPUT; |
88 } | 88 } |
89 | 89 |
90 int SyntheticGestureTargetAndroid::GetTouchSlopInDips() const { | 90 int SyntheticGestureTargetAndroid::GetTouchSlopInDips() const { |
91 float device_scale_factor = | 91 float device_scale_factor = |
92 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().device_scale_factor(); | 92 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().device_scale_factor(); |
93 return gfx::ViewConfiguration::GetTouchSlopInPixels() / device_scale_factor; | 93 return gfx::ViewConfiguration::GetTouchSlopInPixels() / device_scale_factor; |
94 } | 94 } |
95 | 95 |
96 } // namespace content | 96 } // namespace content |
OLD | NEW |