| Index: remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java
|
| diff --git a/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java b/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java
|
| index f5ce54ad8299adfd6df49443fd105b263ca1f871..406b769fa889ac0044b91b90f3f158e6827c9eb1 100644
|
| --- a/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java
|
| +++ b/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java
|
| @@ -21,6 +21,7 @@ import android.widget.TextView;
|
|
|
| import org.chromium.base.CalledByNative;
|
| import org.chromium.base.JNINamespace;
|
| +import org.chromium.chromoting.CapabilityManager;
|
| import org.chromium.chromoting.Chromoting;
|
| import org.chromium.chromoting.R;
|
|
|
| @@ -142,6 +143,9 @@ public class JniInterface {
|
| /** Bitmap holding the cursor shape. Accessed on the graphics thread. */
|
| private static Bitmap sCursorBitmap = null;
|
|
|
| + /** Capability Manager through which capabilities and extensions are handled. */
|
| + private static CapabilityManager sCapabilityManager = CapabilityManager.getInstance();
|
| +
|
| /**
|
| * To be called once from the main Activity. Any subsequent calls will update the application
|
| * context, but not reload the library. This is useful e.g. when the activity is closed and the
|
| @@ -176,13 +180,15 @@ public class JniInterface {
|
| sConnectionListener = listener;
|
| SharedPreferences prefs = sContext.getPreferences(Activity.MODE_PRIVATE);
|
| nativeConnect(username, authToken, hostJid, hostId, hostPubkey,
|
| - prefs.getString(hostId + "_id", ""), prefs.getString(hostId + "_secret", ""));
|
| + prefs.getString(hostId + "_id", ""), prefs.getString(hostId + "_secret", ""),
|
| + sCapabilityManager.getLocalCapabilities());
|
| sConnected = true;
|
| }
|
|
|
| /** Performs the native portion of the connection. */
|
| - private static native void nativeConnect(String username, String authToken, String hostJid,
|
| - String hostId, String hostPubkey, String pairId, String pairSecret);
|
| + private static native void nativeConnect(
|
| + String username, String authToken, String hostJid, String hostId, String hostPubkey,
|
| + String pairId, String pairSecret, String capabilities);
|
|
|
| /** Severs the connection and cleans up. Called on the UI thread. */
|
| public static void disconnectFromHost() {
|
| @@ -458,4 +464,34 @@ public class JniInterface {
|
| * Notify the native code to continue authentication with the |token| and the |sharedSecret|.
|
| */
|
| public static native void nativeOnThirdPartyTokenFetched(String token, String sharedSecret);
|
| +
|
| + //
|
| + // Host and Client Capabilities
|
| + //
|
| +
|
| + /** Set the list of negotiated capabilities between host and client. Called on the UI thread. */
|
| + @CalledByNative
|
| + public static void setCapabilities(String capabilities) {
|
| + sCapabilityManager.setNegotiatedCapabilities(capabilities);
|
| + }
|
| +
|
| + //
|
| + // Extension Message Handling
|
| + //
|
| +
|
| + /** Passes on the deconstructed ExtensionMessage to the app. Called on the UI thread. */
|
| + @CalledByNative
|
| + public static void handleExtensionMessage(String type, String data) {
|
| + sCapabilityManager.onExtensionMessage(type, data);
|
| + }
|
| +
|
| +
|
| + public static void sendExtensionMessage(String type, String data) {
|
| + if (!sConnected)
|
| + return;
|
| +
|
| + nativeSendExtensionMessage(type, data);
|
| + }
|
| +
|
| + public static native void nativeSendExtensionMessage(String type, String data);
|
| }
|
|
|