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

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

Issue 119323007: Add timestamps to synthesized events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove target variables in pinch; fix computation of total duration. Created 6 years, 11 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
« no previous file with comments | « content/browser/renderer_host/input/synthetic_tap_gesture.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/TouchEventSynthesizer.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/TouchEventSynthesizer.java b/content/public/android/java/src/org/chromium/content/browser/TouchEventSynthesizer.java
index 2dd88b9861e516c4a42e2d3a1c9fb1cbd2fdc264..0183821b32b031a4cd1fada0f744d3ef529c6134 100644
--- a/content/public/android/java/src/org/chromium/content/browser/TouchEventSynthesizer.java
+++ b/content/public/android/java/src/org/chromium/content/browser/TouchEventSynthesizer.java
@@ -4,7 +4,6 @@
package org.chromium.content.browser;
-import android.os.SystemClock;
import android.view.MotionEvent;
import android.view.MotionEvent.PointerCoords;
import android.view.MotionEvent.PointerProperties;
@@ -27,7 +26,7 @@ public class TouchEventSynthesizer {
private final ContentViewCore mContentViewCore;
private final PointerProperties[] mPointerProperties;
private final PointerCoords[] mPointerCoords;
- private long mDownTime;
+ private long mDownTimeInMs;
TouchEventSynthesizer(ContentViewCore contentViewCore) {
mContentViewCore = contentViewCore;
@@ -54,14 +53,12 @@ public class TouchEventSynthesizer {
}
@CalledByNative
- void inject(int action, int pointerCount) {
- long time = SystemClock.uptimeMillis();
-
+ void inject(int action, int pointerCount, long timeInMs) {
switch (action) {
case ACTION_START: {
- mDownTime = time;
+ mDownTimeInMs = timeInMs;
MotionEvent event = MotionEvent.obtain(
- mDownTime, time, MotionEvent.ACTION_DOWN, 1,
+ mDownTimeInMs, timeInMs, MotionEvent.ACTION_DOWN, 1,
mPointerProperties, mPointerCoords,
0, 0, 1, 1, 0, 0, 0, 0);
mContentViewCore.onTouchEvent(event);
@@ -69,8 +66,9 @@ public class TouchEventSynthesizer {
if (pointerCount > 1) {
event = MotionEvent.obtain(
- mDownTime, time, MotionEvent.ACTION_POINTER_DOWN,
- pointerCount, mPointerProperties, mPointerCoords,
+ mDownTimeInMs, timeInMs,
+ MotionEvent.ACTION_POINTER_DOWN, pointerCount,
+ mPointerProperties, mPointerCoords,
0, 0, 1, 1, 0, 0, 0, 0);
mContentViewCore.onTouchEvent(event);
event.recycle();
@@ -78,7 +76,7 @@ public class TouchEventSynthesizer {
break;
}
case ACTION_MOVE: {
- MotionEvent event = MotionEvent.obtain(mDownTime, time,
+ MotionEvent event = MotionEvent.obtain(mDownTimeInMs, timeInMs,
MotionEvent.ACTION_MOVE,
pointerCount, mPointerProperties, mPointerCoords,
0, 0, 1, 1, 0, 0, 0, 0);
@@ -88,7 +86,7 @@ public class TouchEventSynthesizer {
}
case ACTION_CANCEL: {
MotionEvent event = MotionEvent.obtain(
- mDownTime, time, MotionEvent.ACTION_CANCEL, 1,
+ mDownTimeInMs, timeInMs, MotionEvent.ACTION_CANCEL, 1,
mPointerProperties, mPointerCoords,
0, 0, 1, 1, 0, 0, 0, 0);
mContentViewCore.onTouchEvent(event);
@@ -98,7 +96,7 @@ public class TouchEventSynthesizer {
case ACTION_END: {
if (pointerCount > 1) {
MotionEvent event = MotionEvent.obtain(
- mDownTime, time, MotionEvent.ACTION_POINTER_UP,
+ mDownTimeInMs, timeInMs, MotionEvent.ACTION_POINTER_UP,
pointerCount, mPointerProperties, mPointerCoords,
0, 0, 1, 1, 0, 0, 0, 0);
mContentViewCore.onTouchEvent(event);
@@ -106,7 +104,7 @@ public class TouchEventSynthesizer {
}
MotionEvent event = MotionEvent.obtain(
- mDownTime, time, MotionEvent.ACTION_UP, 1,
+ mDownTimeInMs, timeInMs, MotionEvent.ACTION_UP, 1,
mPointerProperties, mPointerCoords,
0, 0, 1, 1, 0, 0, 0, 0);
mContentViewCore.onTouchEvent(event);
« no previous file with comments | « content/browser/renderer_host/input/synthetic_tap_gesture.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698