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

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

Issue 2708613002: Add EventForwarder for routing touch events (Closed)
Patch Set: - Created 3 years, 10 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/MotionEventSynthesizer.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/MotionEventSynthesizer.java b/content/public/android/java/src/org/chromium/content/browser/MotionEventSynthesizer.java
index 355bd4801677ff7da41ac1095b281464ca787d0c..3f6a2ef3671aea5568729f4b411a51e1d3c02a2f 100644
--- a/content/public/android/java/src/org/chromium/content/browser/MotionEventSynthesizer.java
+++ b/content/public/android/java/src/org/chromium/content/browser/MotionEventSynthesizer.java
@@ -11,6 +11,7 @@ import android.view.MotionEvent.PointerProperties;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
+import org.chromium.content_public.browser.EventForwarder;
/**
* Provides a Java-side implementation for injecting synthetic touch events.
@@ -26,12 +27,14 @@ public class MotionEventSynthesizer {
private static final int ACTION_SCROLL = 4;
private final ContentViewCore mContentViewCore;
+ private final EventForwarder mEventForwarder;
private final PointerProperties[] mPointerProperties;
private final PointerCoords[] mPointerCoords;
private long mDownTimeInMs;
MotionEventSynthesizer(ContentViewCore contentViewCore) {
mContentViewCore = contentViewCore;
+ mEventForwarder = contentViewCore.getWebContents().getEventForwarder();
mPointerProperties = new PointerProperties[MAX_NUM_POINTERS];
mPointerCoords = new PointerCoords[MAX_NUM_POINTERS];
}
@@ -72,7 +75,7 @@ public class MotionEventSynthesizer {
mDownTimeInMs, timeInMs, MotionEvent.ACTION_DOWN, 1,
mPointerProperties, mPointerCoords,
0, 0, 1, 1, 0, 0, 0, 0);
- mContentViewCore.onTouchEvent(event);
+ mEventForwarder.onTouchEvent(event);
event.recycle();
if (pointerCount > 1) {
@@ -81,7 +84,7 @@ public class MotionEventSynthesizer {
MotionEvent.ACTION_POINTER_DOWN, pointerCount,
mPointerProperties, mPointerCoords,
0, 0, 1, 1, 0, 0, 0, 0);
- mContentViewCore.onTouchEvent(event);
+ mEventForwarder.onTouchEvent(event);
event.recycle();
}
break;
@@ -91,7 +94,7 @@ public class MotionEventSynthesizer {
MotionEvent.ACTION_MOVE,
pointerCount, mPointerProperties, mPointerCoords,
0, 0, 1, 1, 0, 0, 0, 0);
- mContentViewCore.onTouchEvent(event);
+ mEventForwarder.onTouchEvent(event);
event.recycle();
break;
}
@@ -100,7 +103,7 @@ public class MotionEventSynthesizer {
mDownTimeInMs, timeInMs, MotionEvent.ACTION_CANCEL, 1,
mPointerProperties, mPointerCoords,
0, 0, 1, 1, 0, 0, 0, 0);
- mContentViewCore.onTouchEvent(event);
+ mEventForwarder.onTouchEvent(event);
event.recycle();
break;
}
@@ -110,7 +113,7 @@ public class MotionEventSynthesizer {
mDownTimeInMs, timeInMs, MotionEvent.ACTION_POINTER_UP,
pointerCount, mPointerProperties, mPointerCoords,
0, 0, 1, 1, 0, 0, 0, 0);
- mContentViewCore.onTouchEvent(event);
+ mEventForwarder.onTouchEvent(event);
event.recycle();
}
@@ -118,7 +121,7 @@ public class MotionEventSynthesizer {
mDownTimeInMs, timeInMs, MotionEvent.ACTION_UP, 1,
mPointerProperties, mPointerCoords,
0, 0, 1, 1, 0, 0, 0, 0);
- mContentViewCore.onTouchEvent(event);
+ mEventForwarder.onTouchEvent(event);
event.recycle();
break;
}

Powered by Google App Engine
This is Rietveld 408576698