Index: remoting/android/java/src/org/chromium/chromoting/jni/Client.java |
diff --git a/remoting/android/java/src/org/chromium/chromoting/jni/Client.java b/remoting/android/java/src/org/chromium/chromoting/jni/Client.java |
index 058fcac32a59ec182ff9210b3a1d1118df470ce2..3a8114db409322de0fe300403bdba06614d85da0 100644 |
--- a/remoting/android/java/src/org/chromium/chromoting/jni/Client.java |
+++ b/remoting/android/java/src/org/chromium/chromoting/jni/Client.java |
@@ -4,11 +4,16 @@ |
package org.chromium.chromoting.jni; |
+import android.content.Context; |
+ |
import org.chromium.base.annotations.CalledByNative; |
import org.chromium.base.annotations.JNINamespace; |
import org.chromium.base.annotations.SuppressFBWarnings; |
+import org.chromium.chromoting.AbstractDesktopView; |
import org.chromium.chromoting.CapabilityManager; |
+import org.chromium.chromoting.DesktopViewFactory; |
import org.chromium.chromoting.InputStub; |
+import org.chromium.chromoting.Preconditions; |
import org.chromium.chromoting.SessionAuthenticator; |
/** |
@@ -23,8 +28,8 @@ public class Client implements InputStub { |
// Pointer to the C++ object, cast to a |long|. |
private long mNativeJniClient; |
- // Implementation-dependent display object used by the desktop view. |
- private Object mDisplay; |
+ // The factory to create implementation-dependent desktop view. |
+ private DesktopViewFactory mDesktopViewFactory; |
// The global Client instance (may be null). This needs to be a global singleton so that the |
// Client can be passed between Activities. |
@@ -40,21 +45,20 @@ public class Client implements InputStub { |
} |
/** |
- * Sets the display object. Called by the native code when the connection starts. |
- * @param display the implementation-dependent object used by the desktop view. |
+ * Sets the desktop view factory. Called by the native code when the connection starts. |
+ * @param factory The factory to create implementation-dependent desktop view. |
*/ |
@CalledByNative |
- private void setDisplay(Object display) { |
- mDisplay = display; |
+ private void setDesktopViewFactory(DesktopViewFactory factory) { |
Hzj_jie
2016/07/10 19:23:59
Do we really need to have a DesktopViewFactory? It
Yuwei
2016/07/11 00:17:09
Activity will be destroyed and recreated when you
|
+ mDesktopViewFactory = factory; |
} |
/** |
- * Returns the display object. It will be null before calling connectToHost() or after calling |
- * disconnectFromHost(). |
- * @return the display object. |
+ * Creates an implementation specific desktop view. |
*/ |
- public Object getDisplay() { |
- return mDisplay; |
+ public AbstractDesktopView createDesktopView(Context context) { |
+ Preconditions.notNull(mDesktopViewFactory); |
+ return mDesktopViewFactory.createDesktopView(context); |
} |
// Suppress FindBugs warning, since |sClient| is only used on the UI thread. |
@@ -130,8 +134,6 @@ public class Client implements InputStub { |
mConnectionListener = null; |
mConnected = false; |
mCapabilityManager.onHostDisconnect(); |
- |
- mDisplay = null; |
} |
/** Called whenever the connection status changes. */ |