Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: content/browser/renderer_host/input/synthetic_gesture_target_android.cc

Issue 95153002: Make touch-based synthetic gesture take touch slop into account. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: undo pinch refactoring; get device scale factor from gfx::Screen Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/common/android/view_configuration.h"
8 #include "jni/TouchEventSynthesizer_jni.h" 10 #include "jni/TouchEventSynthesizer_jni.h"
9 #include "third_party/WebKit/public/web/WebInputEvent.h" 11 #include "third_party/WebKit/public/web/WebInputEvent.h"
12 #include "ui/gfx/screen.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)
18 : SyntheticGestureTargetBase(host), 21 : SyntheticGestureTargetBase(host),
19 touch_event_synthesizer_(touch_event_synthesizer) { 22 touch_event_synthesizer_(touch_event_synthesizer) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 float device_scale_factor =
88 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().device_scale_factor();
89 return
jdduke (slow) 2013/12/02 16:29:43 Nit: I think this can fit on one line?
Dominik Grewe 2013/12/02 16:42:26 Done.
90 ViewConfiguration::GetTouchSlopInPixels() / device_scale_factor;
91 }
92
83 } // namespace content 93 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698