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

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

Issue 2132883002: [Remoting Android] Placeholder for DesktopView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase ToT and do same fix for GlDisplay Created 4 years, 5 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/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. */

Powered by Google App Engine
This is Rietveld 408576698