| 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 0c2330bdd08c9d4061fdde18c6329de7cefe3063..e79065d3307e349bd34f73662266f5140b33aa9a 100644
|
| --- a/remoting/android/java/src/org/chromium/chromoting/DesktopView.java
|
| +++ b/remoting/android/java/src/org/chromium/chromoting/DesktopView.java
|
| @@ -25,7 +25,7 @@ import android.view.inputmethod.InputConnection;
|
| import android.view.inputmethod.InputMethodManager;
|
|
|
| import org.chromium.base.Log;
|
| -import org.chromium.chromoting.jni.JniInterface;
|
| +import org.chromium.chromoting.jni.Client;
|
|
|
| /**
|
| * The user interface for viewing and interacting with a specific remote host.
|
| @@ -46,6 +46,10 @@ public class DesktopView extends SurfaceView implements DesktopViewInterface,
|
| /** The parent Desktop activity. */
|
| private Desktop mDesktop;
|
|
|
| + /** The Client connection, used to inject input and fetch the video frames. */
|
| + private Client mClient;
|
| +
|
| +
|
| // Flag to prevent multiple repaint requests from being backed up. Requests for repainting will
|
| // be dropped if this is already set to true. This is used by the main thread and the painting
|
| // thread, so the access should be synchronized on |mRenderData|.
|
| @@ -179,6 +183,10 @@ public class DesktopView extends SurfaceView implements DesktopViewInterface,
|
| mDesktop = desktop;
|
| }
|
|
|
| + public void setClient(Client client) {
|
| + mClient = client;
|
| + }
|
| +
|
| /** See {@link TouchInputHandler#onSoftInputMethodVisibilityChanged} for API details. */
|
| public void onSoftInputMethodVisibilityChanged(boolean inputMethodVisible, Rect bounds) {
|
| mInputHandler.onSoftInputMethodVisibilityChanged(inputMethodVisible, bounds);
|
| @@ -192,7 +200,7 @@ public class DesktopView extends SurfaceView implements DesktopViewInterface,
|
| }
|
| mRepaintPending = true;
|
| }
|
| - JniInterface.redrawGraphics();
|
| + mClient.redrawGraphics();
|
| }
|
|
|
| /**
|
| @@ -207,7 +215,7 @@ public class DesktopView extends SurfaceView implements DesktopViewInterface,
|
| Log.w(TAG, "Canvas being redrawn on UI thread");
|
| }
|
|
|
| - Bitmap image = JniInterface.getVideoFrame();
|
| + Bitmap image = mClient.getVideoFrame();
|
| if (image == null) {
|
| // This can happen if the client is connected, but a complete video frame has not yet
|
| // been decoded.
|
| @@ -220,7 +228,7 @@ public class DesktopView extends SurfaceView implements DesktopViewInterface,
|
| synchronized (mRenderData) {
|
| if (mRenderData.imageWidth != width || mRenderData.imageHeight != height) {
|
| // TODO(lambroslambrou): Move this code into a sizeChanged() callback, to be
|
| - // triggered from JniInterface (on the display thread) when the remote screen size
|
| + // triggered from native code (on the display thread) when the remote screen size
|
| // changes.
|
| mRenderData.imageWidth = width;
|
| mRenderData.imageHeight = height;
|
| @@ -266,9 +274,9 @@ public class DesktopView extends SurfaceView implements DesktopViewInterface,
|
| }
|
|
|
| if (drawCursor) {
|
| - Bitmap cursorBitmap = JniInterface.getCursorBitmap();
|
| + Bitmap cursorBitmap = mClient.getCursorBitmap();
|
| if (cursorBitmap != null) {
|
| - Point hotspot = JniInterface.getCursorHotspot();
|
| + Point hotspot = mClient.getCursorHotspot();
|
| canvas.drawBitmap(cursorBitmap, cursorPosition.x - hotspot.x,
|
| cursorPosition.y - hotspot.y, new Paint());
|
| }
|
| @@ -319,7 +327,7 @@ public class DesktopView extends SurfaceView implements DesktopViewInterface,
|
| }
|
|
|
| public void attachRedrawCallback() {
|
| - JniInterface.provideRedrawCallback(new Runnable() {
|
| + mClient.provideRedrawCallback(new Runnable() {
|
| @Override
|
| public void run() {
|
| paint();
|
| @@ -415,15 +423,15 @@ public class DesktopView extends SurfaceView implements DesktopViewInterface,
|
|
|
| switch (inputMode) {
|
| case TRACKPAD:
|
| - mInputHandler.setInputStrategy(new TrackpadInputStrategy(mRenderData));
|
| + mInputHandler.setInputStrategy(new TrackpadInputStrategy(mRenderData, mClient));
|
| break;
|
|
|
| case TOUCH:
|
| if (hostTouchCapability.isSupported()) {
|
| - mInputHandler.setInputStrategy(new TouchInputStrategy(mRenderData));
|
| + mInputHandler.setInputStrategy(new TouchInputStrategy(mRenderData, mClient));
|
| } else {
|
| mInputHandler.setInputStrategy(
|
| - new SimulatedTouchInputStrategy(mRenderData, getContext()));
|
| + new SimulatedTouchInputStrategy(mRenderData, mClient, getContext()));
|
| }
|
| break;
|
|
|
|
|