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

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

Issue 1537183002: Refactor Chromoting JNI code to use jni/Client (Java changes only). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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/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..42b5c1f5e5d8b411e8988e28a1d5a8e23694b402 100644
--- a/remoting/android/java/src/org/chromium/chromoting/SessionAuthenticator.java
+++ b/remoting/android/java/src/org/chromium/chromoting/SessionAuthenticator.java
@@ -16,6 +16,7 @@ import android.widget.CheckBox;
import android.widget.TextView;
import android.widget.Toast;
+import org.chromium.chromoting.jni.Client;
import org.chromium.chromoting.jni.JniInterface;
/**
@@ -29,14 +30,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 +67,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 +83,7 @@ public class SessionAuthenticator {
R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- JniInterface.disconnectFromHost();
+ JniInterface.destroyClient();
Sergey Ulanov 2015/12/21 17:58:15 can this be replaced with a call to mClient? i.e.
Lambros 2016/01/29 23:58:25 Done.
}
});
@@ -138,7 +143,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(),

Powered by Google App Engine
This is Rietveld 408576698