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" | |
9 #include "content/browser/renderer_host/render_widget_host_view_android.h" | |
10 #include "content/common/android/view_configuration.h" | |
8 #include "jni/TouchEventSynthesizer_jni.h" | 11 #include "jni/TouchEventSynthesizer_jni.h" |
9 #include "third_party/WebKit/public/web/WebInputEvent.h" | 12 #include "third_party/WebKit/public/web/WebInputEvent.h" |
10 | 13 |
11 using blink::WebTouchEvent; | 14 using blink::WebTouchEvent; |
12 | 15 |
13 namespace content { | 16 namespace content { |
14 | 17 |
15 SyntheticGestureTargetAndroid::SyntheticGestureTargetAndroid( | 18 SyntheticGestureTargetAndroid::SyntheticGestureTargetAndroid( |
16 RenderWidgetHostImpl* host, | 19 RenderWidgetHostImpl* host, |
17 base::android::ScopedJavaLocalRef<jobject> touch_event_synthesizer) | 20 base::android::ScopedJavaLocalRef<jobject> touch_event_synthesizer) |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 SyntheticGestureParams::GestureSourceType | 76 SyntheticGestureParams::GestureSourceType |
74 SyntheticGestureTargetAndroid::GetDefaultSyntheticGestureSourceType() const { | 77 SyntheticGestureTargetAndroid::GetDefaultSyntheticGestureSourceType() const { |
75 return SyntheticGestureParams::TOUCH_INPUT; | 78 return SyntheticGestureParams::TOUCH_INPUT; |
76 } | 79 } |
77 | 80 |
78 bool SyntheticGestureTargetAndroid::SupportsSyntheticGestureSourceType( | 81 bool SyntheticGestureTargetAndroid::SupportsSyntheticGestureSourceType( |
79 SyntheticGestureParams::GestureSourceType gesture_source_type) const { | 82 SyntheticGestureParams::GestureSourceType gesture_source_type) const { |
80 return gesture_source_type == SyntheticGestureParams::TOUCH_INPUT; | 83 return gesture_source_type == SyntheticGestureParams::TOUCH_INPUT; |
81 } | 84 } |
82 | 85 |
86 int SyntheticGestureTargetAndroid::GetTouchSlopInDips() const { | |
87 // Option 1: Get touch slop in DIPs directly (deprecated). | |
88 //return ViewConfiguration::GetTouchSlopInDips(); | |
89 | |
90 // Option 2: Get touch slop in pixels and convert to DIPs | |
91 RenderWidgetHostViewAndroid* view = static_cast<RenderWidgetHostViewAndroid*>( | |
92 render_widget_host()->GetView()); | |
93 return | |
94 ViewConfiguration::GetTouchSlopInPixels() / view->GetDeviceScaleFactor(); | |
jdduke (slow)
2013/12/02 15:51:40
You can use the following to save yourself some tr
Dominik Grewe
2013/12/02 16:18:54
Nice! Wasn't aware of that.
| |
95 } | |
96 | |
83 } // namespace content | 97 } // namespace content |
OLD | NEW |