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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java

Issue 23346003: [Android] Add mechanism to disable double tap/drag zooming. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: joth comment. Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java
index 053aa9a48a3dbd1c1d2577f13d47d772a41cdd2d..37fd170fccbf5f29d9657186799313187c0f9411 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java
@@ -176,6 +176,7 @@ class ContentViewGestureHandler implements LongPressDelegate {
static final int DOUBLE_TAP_DRAG_MODE_NONE = 0;
static final int DOUBLE_TAP_DRAG_MODE_DETECTION_IN_PROGRESS = 1;
static final int DOUBLE_TAP_DRAG_MODE_ZOOM = 2;
+ static final int DOUBLE_TAP_DRAG_MODE_DISABLED = 3;
private class TouchEventTimeoutHandler implements Runnable {
private static final int TOUCH_EVENT_TIMEOUT = 200;
@@ -510,6 +511,7 @@ class ContentViewGestureHandler implements LongPressDelegate {
@Override
public boolean onDoubleTapEvent(MotionEvent e) {
+ if (isDoubleTapDragDisabled()) return false;
switch (e.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
sendShowPressCancelIfNecessary(e);
@@ -569,7 +571,8 @@ class ContentViewGestureHandler implements LongPressDelegate {
@Override
public void onLongPress(MotionEvent e) {
if (!mZoomManager.isScaleGestureDetectionInProgress() &&
- mDoubleTapDragMode == DOUBLE_TAP_DRAG_MODE_NONE) {
+ (mDoubleTapDragMode == DOUBLE_TAP_DRAG_MODE_NONE ||
+ isDoubleTapDragDisabled())) {
sendShowPressCancelIfNecessary(e);
sendMotionEventAsGesture(GESTURE_LONG_PRESS, e, null);
}
@@ -664,6 +667,7 @@ class ContentViewGestureHandler implements LongPressDelegate {
* to send. This argument is an optional and can be null.
*/
void endDoubleTapDragMode(MotionEvent event) {
+ if (isDoubleTapDragDisabled()) return;
if (mDoubleTapDragMode == DOUBLE_TAP_DRAG_MODE_ZOOM) {
if (event == null) event = obtainActionCancelMotionEvent();
pinchEnd(event.getEventTime());
@@ -1148,4 +1152,15 @@ class ContentViewGestureHandler implements LongPressDelegate {
boolean hasScheduledTouchTimeoutEventForTesting() {
return mTouchEventTimeoutHandler.hasScheduledTimeoutEventForTesting();
}
+
+ public void updateDoubleTapDragSupport(boolean supportDoubleTapDrag) {
+ assert (mDoubleTapDragMode == DOUBLE_TAP_DRAG_MODE_DISABLED ||
+ mDoubleTapDragMode == DOUBLE_TAP_DRAG_MODE_NONE);
+ mDoubleTapDragMode = supportDoubleTapDrag ?
+ DOUBLE_TAP_DRAG_MODE_NONE : DOUBLE_TAP_DRAG_MODE_DISABLED;
+ }
+
+ private boolean isDoubleTapDragDisabled() {
+ return mDoubleTapDragMode == DOUBLE_TAP_DRAG_MODE_DISABLED;
+ }
}

Powered by Google App Engine
This is Rietveld 408576698