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

Unified Diff: remoting/android/java/src/org/chromium/chromoting/SimulatedTouchInputStrategy.java

Issue 1537183002: Refactor Chromoting JNI code to use jni/Client (Java changes only). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Suppress FindBugs warning Created 4 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: remoting/android/java/src/org/chromium/chromoting/SimulatedTouchInputStrategy.java
diff --git a/remoting/android/java/src/org/chromium/chromoting/SimulatedTouchInputStrategy.java b/remoting/android/java/src/org/chromium/chromoting/SimulatedTouchInputStrategy.java
index 2c3ded29622f81c109485d253bcfae680db369d7..ccc0dbd60b6bb4af4409ce02b9a41f172fc3cd03 100644
--- a/remoting/android/java/src/org/chromium/chromoting/SimulatedTouchInputStrategy.java
+++ b/remoting/android/java/src/org/chromium/chromoting/SimulatedTouchInputStrategy.java
@@ -10,7 +10,7 @@ import android.os.SystemClock;
import android.view.MotionEvent;
import android.view.ViewConfiguration;
-import org.chromium.chromoting.jni.JniInterface;
+import org.chromium.chromoting.jni.Client;
/**
* This class receives local touch events and translates them into the appropriate mouse based
@@ -22,6 +22,7 @@ public class SimulatedTouchInputStrategy implements InputStrategyInterface {
private static final float DOUBLE_TAP_SLOP_SCALE_FACTOR = 0.25f;
private final RenderData mRenderData;
+ private final Client mClient;
/**
* Stores the time of the most recent left button single tap processed.
@@ -48,8 +49,9 @@ public class SimulatedTouchInputStrategy implements InputStrategyInterface {
/** Mouse-button currently held down, or BUTTON_UNDEFINED otherwise. */
private int mHeldButton = TouchInputHandlerInterface.BUTTON_UNDEFINED;
- public SimulatedTouchInputStrategy(RenderData renderData, Context context) {
+ public SimulatedTouchInputStrategy(RenderData renderData, Client client, Context context) {
mRenderData = renderData;
+ mClient = client;
ViewConfiguration config = ViewConfiguration.get(context);
mDoubleTapDurationInMs = config.getDoubleTapTimeout();
@@ -121,7 +123,7 @@ public class SimulatedTouchInputStrategy implements InputStrategyInterface {
@Override
public void onScroll(float distanceX, float distanceY) {
- JniInterface.sendMouseWheelEvent((int) -distanceX, (int) -distanceY);
+ mClient.sendMouseWheelEvent((int) -distanceX, (int) -distanceY);
}
@Override
@@ -135,7 +137,7 @@ public class SimulatedTouchInputStrategy implements InputStrategyInterface {
@Override
public void injectCursorMoveEvent(int x, int y) {
- JniInterface.sendMouseEvent(x, y, TouchInputHandlerInterface.BUTTON_UNDEFINED, false);
+ mClient.sendMouseEvent(x, y, TouchInputHandlerInterface.BUTTON_UNDEFINED, false);
}
@Override
@@ -180,6 +182,6 @@ public class SimulatedTouchInputStrategy implements InputStrategyInterface {
}
private void injectMouseButtonEvent(int button, boolean pressed, Point tapPoint) {
- JniInterface.sendMouseEvent(tapPoint.x, tapPoint.y, button, pressed);
+ mClient.sendMouseEvent(tapPoint.x, tapPoint.y, button, pressed);
}
}

Powered by Google App Engine
This is Rietveld 408576698