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..4a65e197cc6da4e302a25f58deb016f728420f98 100644 |
--- a/remoting/android/java/src/org/chromium/chromoting/jni/Client.java |
+++ b/remoting/android/java/src/org/chromium/chromoting/jni/Client.java |
@@ -4,10 +4,14 @@ |
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.SessionAuthenticator; |
@@ -23,8 +27,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 +44,19 @@ 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. |
Lambros
2016/07/08 22:02:36
s/the/The/
Yuwei
2016/07/08 23:46:01
Done.
|
*/ |
@CalledByNative |
- private void setDisplay(Object display) { |
- mDisplay = display; |
+ private void setDesktopViewFactory(DesktopViewFactory factory) { |
+ mDesktopViewFactory = factory; |
} |
- /** |
- * Returns the display object. It will be null before calling connectToHost() or after calling |
- * disconnectFromHost(). |
- * @return the display object. |
- */ |
- public Object getDisplay() { |
- return mDisplay; |
+ public AbstractDesktopView createDesktopView(Context context) { |
+ if (mDesktopViewFactory == null) { |
Lambros
2016/07/08 22:02:36
Do we need a null-check here? Maybe use Preconditi
Yuwei
2016/07/08 23:46:01
Done.
|
+ return null; |
+ } |
+ return mDesktopViewFactory.createDesktopView(context); |
} |
// Suppress FindBugs warning, since |sClient| is only used on the UI thread. |
@@ -130,8 +132,6 @@ public class Client implements InputStub { |
mConnectionListener = null; |
mConnected = false; |
mCapabilityManager.onHostDisconnect(); |
- |
- mDisplay = null; |
} |
/** Called whenever the connection status changes. */ |