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

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

Issue 2066683003: [Chromoting] Add InputInjector and InputInjectorWrapper for easy unittesting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix FindBugs errors Created 4 years, 6 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/TouchInputHandler.java
diff --git a/remoting/android/java/src/org/chromium/chromoting/TouchInputHandler.java b/remoting/android/java/src/org/chromium/chromoting/TouchInputHandler.java
index 5ed6b968eef63f9fa8e5489ed867a9ec8f044193..c69bfb9c2bdd0ac2abe220ae573f430c8e0456a2 100644
--- a/remoting/android/java/src/org/chromium/chromoting/TouchInputHandler.java
+++ b/remoting/android/java/src/org/chromium/chromoting/TouchInputHandler.java
@@ -14,14 +14,18 @@ import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.ViewConfiguration;
-import org.chromium.chromoting.jni.Client;
-
/**
* This class is responsible for handling Touch input from the user. Touch events which manipulate
* the local canvas are handled in this class and any input which should be sent to the remote host
* are passed to the InputStrategyInterface implementation set by the DesktopView.
*/
-public class TouchInputHandler implements TouchInputHandlerInterface {
+public class TouchInputHandler {
+ // These constants must match those in the generated struct protocol::MouseEvent_MouseButton.
+ public static final int BUTTON_UNDEFINED = 0;
+ public static final int BUTTON_LEFT = 1;
+ public static final int BUTTON_MIDDLE = 2;
+ public static final int BUTTON_RIGHT = 3;
+
private final DesktopViewInterface mViewer;
private final Context mContext;
private final RenderData mRenderData;
@@ -216,7 +220,6 @@ public class TouchInputHandler implements TouchInputHandlerInterface {
attachViewEvents(viewer);
}
- @Override
public void processAnimation() {
boolean active = mCursorAnimationJob.processAnimation();
active |= mScrollAnimationJob.processAnimation();
@@ -226,14 +229,13 @@ public class TouchInputHandler implements TouchInputHandlerInterface {
}
}
- @Override
- public void init(Desktop desktop, final Client client) {
- Preconditions.notNull(client);
+ public void init(Desktop desktop, final InputInjectorWrapper injector) {
+ Preconditions.notNull(injector);
desktop.onInputModeChanged().add(
new Event.ParameterRunnable<InputModeChangedEventParameter>() {
@Override
public void run(InputModeChangedEventParameter parameter) {
- handleInputModeChanged(parameter, client);
+ handleInputModeChanged(parameter, injector);
}
});
@@ -268,7 +270,7 @@ public class TouchInputHandler implements TouchInputHandlerInterface {
}
private void handleInputModeChanged(InputModeChangedEventParameter parameter,
- Client client) {
+ InputInjectorWrapper injector) {
Lambros 2016/06/17 23:00:10 Wrong indentation.
Hzj_jie 2016/06/19 23:41:39 Done.
final Desktop.InputMode inputMode = parameter.inputMode;
final CapabilityManager.HostCapability hostTouchCapability =
parameter.hostCapability;
@@ -280,15 +282,15 @@ public class TouchInputHandler implements TouchInputHandlerInterface {
switch (inputMode) {
case TRACKPAD:
- setInputStrategy(new TrackpadInputStrategy(mRenderData, client));
+ setInputStrategy(new TrackpadInputStrategy(mRenderData, injector));
break;
case TOUCH:
if (hostTouchCapability.isSupported()) {
- setInputStrategy(new TouchInputStrategy(mRenderData, client));
+ setInputStrategy(new TouchInputStrategy(mRenderData, injector));
} else {
setInputStrategy(new SimulatedTouchInputStrategy(
- mRenderData, client, mContext));
+ mRenderData, injector, mContext));
}
break;

Powered by Google App Engine
This is Rietveld 408576698