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

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 2783233004: Refine tap disambiguation UMA to track same-node/different-node. (Closed)
Patch Set: Deprecate existing field Created 3 years, 8 months 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/android/content_view_core_impl.h" 5 #include "content/browser/android/content_view_core_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 void ContentViewCoreImpl::FlingCancel(JNIEnv* env, 972 void ContentViewCoreImpl::FlingCancel(JNIEnv* env,
973 const JavaParamRef<jobject>& obj, 973 const JavaParamRef<jobject>& obj,
974 jlong time_ms) { 974 jlong time_ms) {
975 WebGestureEvent event = MakeGestureEvent( 975 WebGestureEvent event = MakeGestureEvent(
976 WebInputEvent::GestureFlingCancel, time_ms, 0, 0); 976 WebInputEvent::GestureFlingCancel, time_ms, 0, 0);
977 event.data.flingCancel.preventBoosting = true; 977 event.data.flingCancel.preventBoosting = true;
978 978
979 SendGestureEvent(event); 979 SendGestureEvent(event);
980 } 980 }
981 981
982 void ContentViewCoreImpl::SingleTap(JNIEnv* env,
983 const JavaParamRef<jobject>& obj,
984 jlong time_ms,
985 jfloat x,
986 jfloat y) {
987 // Tap gestures should always be preceded by a TapDown, ensuring consistency
988 // with the touch-based gesture detection pipeline.
989 WebGestureEvent tap_down_event = MakeGestureEvent(
990 WebInputEvent::GestureTapDown, time_ms, x, y);
991 tap_down_event.data.tap.tapCount = 1;
992 SendGestureEvent(tap_down_event);
993
994 WebGestureEvent tap_event = MakeGestureEvent(
995 WebInputEvent::GestureTap, time_ms, x, y);
996 tap_event.data.tap.tapCount = 1;
997 SendGestureEvent(tap_event);
998 }
999
1000 void ContentViewCoreImpl::DoubleTap(JNIEnv* env, 982 void ContentViewCoreImpl::DoubleTap(JNIEnv* env,
1001 const JavaParamRef<jobject>& obj, 983 const JavaParamRef<jobject>& obj,
1002 jlong time_ms, 984 jlong time_ms,
1003 jfloat x, 985 jfloat x,
1004 jfloat y) { 986 jfloat y) {
1005 WebGestureEvent event = MakeGestureEvent( 987 WebGestureEvent event = MakeGestureEvent(
1006 WebInputEvent::GestureDoubleTap, time_ms, x, y); 988 WebInputEvent::GestureDoubleTap, time_ms, x, y);
1007 // Set the tap count to 1 even for DoubleTap, in order to be consistent with 989 // Set the tap count to 1 even for DoubleTap, in order to be consistent with
1008 // double tap behavior on a mobile viewport. See crbug.com/234986 for context. 990 // double tap behavior on a mobile viewport. See crbug.com/234986 for context.
1009 event.data.tap.tapCount = 1; 991 event.data.tap.tapCount = 1;
1010 992
1011 SendGestureEvent(event); 993 SendGestureEvent(event);
1012 } 994 }
1013 995
1014 void ContentViewCoreImpl::LongPress(JNIEnv* env, 996 void ContentViewCoreImpl::ResolveTapDisambiguation(
1015 const JavaParamRef<jobject>& obj, 997 JNIEnv* env,
1016 jlong time_ms, 998 const JavaParamRef<jobject>& obj,
1017 jfloat x, 999 jlong time_ms,
1018 jfloat y) { 1000 jfloat x,
1019 WebGestureEvent event = MakeGestureEvent( 1001 jfloat y,
1020 WebInputEvent::GestureLongPress, time_ms, x, y); 1002 jboolean is_long_press) {
1003 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid();
1004 if (!rwhv)
1005 return;
1021 1006
1022 SendGestureEvent(event); 1007 rwhv->ResolveTapDisambiguation(time_ms / 1000.0,
1008 gfx::Point(x / dpi_scale_, y / dpi_scale_),
1009 is_long_press);
1023 } 1010 }
1024 1011
1025 void ContentViewCoreImpl::PinchBegin(JNIEnv* env, 1012 void ContentViewCoreImpl::PinchBegin(JNIEnv* env,
1026 const JavaParamRef<jobject>& obj, 1013 const JavaParamRef<jobject>& obj,
1027 jlong time_ms, 1014 jlong time_ms,
1028 jfloat x, 1015 jfloat x,
1029 jfloat y) { 1016 jfloat y) {
1030 WebGestureEvent event = MakeGestureEvent( 1017 WebGestureEvent event = MakeGestureEvent(
1031 WebInputEvent::GesturePinchBegin, time_ms, x, y); 1018 WebInputEvent::GesturePinchBegin, time_ms, x, y);
1032 SendGestureEvent(event); 1019 SendGestureEvent(event);
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 return ScopedJavaLocalRef<jobject>(); 1397 return ScopedJavaLocalRef<jobject>();
1411 1398
1412 return view->GetJavaObject(); 1399 return view->GetJavaObject();
1413 } 1400 }
1414 1401
1415 bool RegisterContentViewCore(JNIEnv* env) { 1402 bool RegisterContentViewCore(JNIEnv* env) {
1416 return RegisterNativesImpl(env); 1403 return RegisterNativesImpl(env);
1417 } 1404 }
1418 1405
1419 } // namespace content 1406 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/content_view_core_impl.h ('k') | content/browser/renderer_host/render_widget_host_view_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698