| Index: remoting/android/host/src/org/chromium/chromoting/host/jni/Host.java
|
| diff --git a/remoting/android/host/src/org/chromium/chromoting/host/jni/Host.java b/remoting/android/host/src/org/chromium/chromoting/host/jni/Host.java
|
| index 5d81f9ebe92b62c4395683166c71f00e09f9a7f1..dbf7630a609e80da65ac644f5f06bd3912b325b3 100644
|
| --- a/remoting/android/host/src/org/chromium/chromoting/host/jni/Host.java
|
| +++ b/remoting/android/host/src/org/chromium/chromoting/host/jni/Host.java
|
| @@ -7,6 +7,8 @@ package org.chromium.chromoting.host.jni;
|
| import android.content.Context;
|
|
|
| import org.chromium.base.ContextUtils;
|
| +import org.chromium.base.Log;
|
| +import org.chromium.base.annotations.CalledByNative;
|
| import org.chromium.base.annotations.JNINamespace;
|
|
|
| /**
|
| @@ -15,11 +17,15 @@ import org.chromium.base.annotations.JNINamespace;
|
| */
|
| @JNINamespace("remoting")
|
| public class Host {
|
| + private static final String TAG = "host";
|
| +
|
| // Pointer to the C++ object, cast to a |long|.
|
| private long mNativeJniHost;
|
|
|
| private static boolean sLoaded;
|
|
|
| + private It2MeObserver mObserver;
|
| +
|
| // Called once from the main Activity. Loads and initializes the native
|
| // code.
|
| public static void loadLibrary(Context context) {
|
| @@ -42,7 +48,8 @@ public class Host {
|
|
|
| private native void nativeDestroy(long nativeJniHost);
|
|
|
| - public void connect(String userName, String authToken) {
|
| + public void connect(String userName, String authToken, It2MeObserver observer) {
|
| + mObserver = observer;
|
| nativeConnect(mNativeJniHost, userName, authToken);
|
| }
|
|
|
| @@ -53,4 +60,19 @@ public class Host {
|
| }
|
|
|
| private native void nativeDisconnect(long nativeJniHost);
|
| +
|
| + @CalledByNative
|
| + private void onStateChanged(int state, String errorMessage) {
|
| + It2MeObserver.State[] states = It2MeObserver.State.values();
|
| + if (state < 0 || state >= states.length) {
|
| + Log.e(TAG, "Invalid It2Me state: %d", state);
|
| + return;
|
| + }
|
| + mObserver.onStateChanged(states[state], errorMessage);
|
| + }
|
| +
|
| + @CalledByNative
|
| + private void onStoreAccessCode(String accessCode, int lifetimeSeconds) {
|
| + mObserver.onStoreAccessCode(accessCode, lifetimeSeconds);
|
| + }
|
| }
|
|
|