Chromium Code Reviews| 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 30982cc7286e405afb890d056a8a6ec5f3638da0..51ed37d8c7442fbce26a1e48ff18708cc94c1ea1 100644 |
| --- a/remoting/android/java/src/org/chromium/chromoting/jni/Client.java |
| +++ b/remoting/android/java/src/org/chromium/chromoting/jni/Client.java |
| @@ -4,17 +4,12 @@ |
| 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.CapabilityManager; |
| -import org.chromium.chromoting.Desktop; |
| -import org.chromium.chromoting.DesktopView; |
| -import org.chromium.chromoting.DesktopViewFactory; |
| import org.chromium.chromoting.InputStub; |
| -import org.chromium.chromoting.Preconditions; |
| +import org.chromium.chromoting.RenderStub; |
| import org.chromium.chromoting.SessionAuthenticator; |
| /** |
| @@ -27,10 +22,9 @@ import org.chromium.chromoting.SessionAuthenticator; |
| @JNINamespace("remoting") |
| public class Client implements InputStub { |
| // Pointer to the C++ object, cast to a |long|. |
| - private long mNativeJniClient; |
| + private final long mNativeJniClient; |
| - // The factory to create implementation-dependent desktop view. |
| - private DesktopViewFactory mDesktopViewFactory; |
| + private RenderStub mRenderStub; |
| // The global Client instance (may be null). This needs to be a global singleton so that the |
| // Client can be passed between Activities. |
| @@ -45,23 +39,6 @@ public class Client implements InputStub { |
| mNativeJniClient = nativeInit(); |
| } |
| - /** |
| - * Sets the desktop view factory to be used by {@link Client#createDesktopView(Context)}. |
| - * @param factory The factory to create implementation-dependent desktop view. |
| - */ |
| - public void setDesktopViewFactory(DesktopViewFactory factory) { |
| - mDesktopViewFactory = factory; |
| - } |
| - |
| - /** |
| - * Creates an implementation specific {@link DesktopView} using the |
| - * {@link DesktopViewFactory} set by {@link Client#setDesktopViewFactory(DesktopViewFactory)}. |
| - */ |
| - public DesktopView createDesktopView(Desktop desktop, Client client) { |
| - Preconditions.notNull(mDesktopViewFactory); |
| - return mDesktopViewFactory.createDesktopView(desktop, client); |
| - } |
| - |
| // Suppress FindBugs warning, since |sClient| is only used on the UI thread. |
| @SuppressFBWarnings("LI_LAZY_INIT_STATIC") |
| public void destroy() { |
| @@ -72,6 +49,14 @@ public class Client implements InputStub { |
| } |
| } |
| + public void setRenderStub(RenderStub stub) { |
| + mRenderStub = stub; |
|
Hzj_jie
2016/09/10 02:06:32
Add Preconditions here. If I have made a mistake,
Yuwei
2016/09/12 18:56:14
Done.
BTW why is the Precondition implemented by
Hzj_jie
2016/09/12 21:28:04
In Java, assertions take effect only with -ea opti
Yuwei
2016/09/12 21:50:04
Acknowledged.
|
| + } |
| + |
| + public RenderStub getRenderStub() { |
|
Hzj_jie
2016/09/10 02:06:32
And here.
Yuwei
2016/09/12 18:56:14
Done.
|
| + return mRenderStub; |
| + } |
| + |
| /** Returns the current Client instance, or null. */ |
| public static Client getInstance() { |
|
Hzj_jie
2016/09/10 02:06:32
Suggest to add a Preconditions.notNull here, and u
Yuwei
2016/09/12 18:56:13
I think it may make more sense to check it in Desk
Hzj_jie
2016/09/12 21:28:04
Yes, both OK.
|
| return sClient; |