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

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

Issue 2035303002: [Chromoting] Decouple DesktopView and TouchInputHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/DesktopView.java
diff --git a/remoting/android/java/src/org/chromium/chromoting/DesktopView.java b/remoting/android/java/src/org/chromium/chromoting/DesktopView.java
index 47fff9d9eda7cdc50616eb63cb7cf2915391da79..8c4e1faeec3b38900dbbc5540baea802a94fb16f 100644
--- a/remoting/android/java/src/org/chromium/chromoting/DesktopView.java
+++ b/remoting/android/java/src/org/chromium/chromoting/DesktopView.java
@@ -10,7 +10,6 @@ import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Point;
-import android.graphics.Rect;
import android.os.Looper;
import android.os.SystemClock;
import android.text.InputType;
@@ -82,21 +81,19 @@ public class DesktopView extends SurfaceView implements DesktopViewInterface,
getHolder().addCallback(this);
}
- public Event<PaintEventParameter> onPaint() {
- return mOnPaint;
- }
-
- public void setDesktop(Desktop desktop) {
+ @Override
+ public void init(Desktop desktop, Client client) {
+ Preconditions.isNull(mDesktop);
+ Preconditions.isNull(mClient);
+ Preconditions.notNull(desktop);
+ Preconditions.notNull(client);
mDesktop = desktop;
- }
-
- public void setClient(Client client) {
mClient = client;
+ mInputHandler.init(desktop, client);
}
- /** See {@link TouchInputHandler#onSoftInputMethodVisibilityChanged} for API details. */
- public void onSoftInputMethodVisibilityChanged(boolean inputMethodVisible, Rect bounds) {
- mInputHandler.onSoftInputMethodVisibilityChanged(inputMethodVisible, bounds);
+ public Event<PaintEventParameter> onPaint() {
+ return mOnPaint;
}
/** Request repainting of the desktop view. */
@@ -316,35 +313,4 @@ public class DesktopView extends SurfaceView implements DesktopViewInterface,
mInputAnimationRunning = enabled;
}
}
-
- /** Updates the current InputStrategy used by the TouchInputHandler. */
- public void changeInputMode(
- Desktop.InputMode inputMode, CapabilityManager.HostCapability hostTouchCapability) {
- // We need both input mode and host input capabilities to select the input strategy.
- if (!inputMode.isSet() || !hostTouchCapability.isSet()) {
- return;
- }
-
- switch (inputMode) {
- case TRACKPAD:
- mInputHandler.setInputStrategy(new TrackpadInputStrategy(mRenderData, mClient));
- break;
-
- case TOUCH:
- if (hostTouchCapability.isSupported()) {
- mInputHandler.setInputStrategy(new TouchInputStrategy(mRenderData, mClient));
- } else {
- mInputHandler.setInputStrategy(
- new SimulatedTouchInputStrategy(mRenderData, mClient, getContext()));
- }
- break;
-
- default:
- // Unreachable, but required by Google Java style and findbugs.
- assert false : "Unreached";
- }
-
- // Ensure the cursor state is updated appropriately.
- requestRepaint();
- }
}

Powered by Google App Engine
This is Rietveld 408576698