Index: remoting/android/java/src/org/chromium/chromoting/SessionAuthenticator.java |
diff --git a/remoting/android/java/src/org/chromium/chromoting/SessionAuthenticator.java b/remoting/android/java/src/org/chromium/chromoting/SessionAuthenticator.java |
index a18c2f463782a5a430a090b226c7908d05be9d07..ce50a040231dd17d144310add62ce39b22e60f00 100644 |
--- a/remoting/android/java/src/org/chromium/chromoting/SessionAuthenticator.java |
+++ b/remoting/android/java/src/org/chromium/chromoting/SessionAuthenticator.java |
@@ -16,7 +16,7 @@ import android.widget.CheckBox; |
import android.widget.TextView; |
import android.widget.Toast; |
-import org.chromium.chromoting.jni.JniInterface; |
+import org.chromium.chromoting.jni.Client; |
/** |
* This class performs the user-interaction needed to authenticate the session connection. This |
@@ -29,14 +29,18 @@ public class SessionAuthenticator { |
*/ |
private Chromoting mApplicationContext; |
+ /** Client connection being authenticated. */ |
+ private final Client mClient; |
+ |
/** Provides the tokenUrlPatterns for this host during fetchThirdPartyTokens(). */ |
private HostInfo mHost; |
/** Object for fetching OAuth2 access tokens from third party authorization servers. */ |
private ThirdPartyTokenFetcher mTokenFetcher; |
- public SessionAuthenticator(Chromoting context, HostInfo host) { |
+ public SessionAuthenticator(Chromoting context, Client client, HostInfo host) { |
mApplicationContext = context; |
+ mClient = client; |
mHost = host; |
} |
@@ -62,8 +66,8 @@ public class SessionAuthenticator { |
R.string.connect_button, new DialogInterface.OnClickListener() { |
@Override |
public void onClick(DialogInterface dialog, int which) { |
- if (JniInterface.isConnected()) { |
- JniInterface.handleAuthenticationResponse( |
+ if (mClient.isConnected()) { |
+ mClient.handleAuthenticationResponse( |
String.valueOf(pinTextView.getText()), |
pinCheckBox.isChecked(), Build.MODEL); |
} else { |
@@ -78,7 +82,7 @@ public class SessionAuthenticator { |
R.string.cancel, new DialogInterface.OnClickListener() { |
@Override |
public void onClick(DialogInterface dialog, int which) { |
- JniInterface.disconnectFromHost(); |
+ mClient.destroy(); |
} |
}); |
@@ -138,7 +142,7 @@ public class SessionAuthenticator { |
// authenticate itself with the host using spake. |
String sharedSecret = accessToken; |
- JniInterface.onThirdPartyTokenFetched(token, sharedSecret); |
+ mClient.onThirdPartyTokenFetched(token, sharedSecret); |
} |
}; |
mTokenFetcher = new ThirdPartyTokenFetcher(mApplicationContext, mHost.getTokenUrlPatterns(), |