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

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

Issue 981783003: Pull authentication UX code out of JniInterface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix-jni-initialization
Patch Set: Fix comment Created 5 years, 9 months 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
« no previous file with comments | « no previous file | remoting/android/java/src/org/chromium/chromoting/SessionAuthenticator.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/android/java/src/org/chromium/chromoting/Chromoting.java
diff --git a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java
index 8fdd14d1a7b408cd4b7aba336470a845fb649cfc..15a8b15f32f8a7ca70f38d573824730eea5b5daf 100644
--- a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java
+++ b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java
@@ -90,8 +90,11 @@ public class Chromoting extends ActionBarActivity implements JniInterface.Connec
/** Dialog for reporting connection progress. */
private ProgressDialog mProgressIndicator;
- /** Object for fetching OAuth2 access tokens from third party authorization servers. */
- private ThirdPartyTokenFetcher mTokenFetcher;
+ /**
+ * Helper used by SessionConnection for session authentication. Receives onNewIntent()
+ * notifications to handle third-party authentication.
+ */
+ private SessionAuthenticator mAuthenticator;
/**
* This is set when receiving an authentication error from the HostListLoader. If that occurs,
@@ -214,10 +217,9 @@ public class Chromoting extends ActionBarActivity implements JniInterface.Connec
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
- if (mTokenFetcher != null) {
- if (mTokenFetcher.handleTokenFetched(intent)) {
- mTokenFetcher = null;
- }
+
+ if (mAuthenticator != null) {
+ mAuthenticator.onNewIntent(intent);
}
}
@@ -323,13 +325,11 @@ public class Chromoting extends ActionBarActivity implements JniInterface.Connec
@Override
public void onCancel(DialogInterface dialog) {
JniInterface.disconnectFromHost();
- mTokenFetcher = null;
}
});
SessionConnector connector = new SessionConnector(this, this, mHostListLoader);
- assert mTokenFetcher == null;
- mTokenFetcher = createTokenFetcher(host);
- connector.connectToHost(mAccount.name, mToken, host);
+ mAuthenticator = new SessionAuthenticator(this, host);
+ connector.connectToHost(mAccount.name, mToken, host, mAuthenticator);
}
private void refreshHostList() {
@@ -510,28 +510,4 @@ public class Chromoting extends ActionBarActivity implements JniInterface.Connec
mProgressIndicator = null;
}
}
-
- private ThirdPartyTokenFetcher createTokenFetcher(HostInfo host) {
- ThirdPartyTokenFetcher.Callback callback = new ThirdPartyTokenFetcher.Callback() {
- @Override
- public void onTokenFetched(String code, String accessToken) {
- // The native client sends the OAuth authorization code to the host as the token so
- // that the host can obtain the shared secret from the third party authorization
- // server.
- String token = code;
-
- // The native client uses the OAuth access token as the shared secret to
- // authenticate itself with the host using spake.
- String sharedSecret = accessToken;
-
- JniInterface.onThirdPartyTokenFetched(token, sharedSecret);
- }
- };
- return new ThirdPartyTokenFetcher(this, host.getTokenUrlPatterns(), callback);
- }
-
- public void fetchThirdPartyToken(String tokenUrl, String clientId, String scope) {
- assert mTokenFetcher != null;
- mTokenFetcher.fetchToken(tokenUrl, clientId, scope);
- }
}
« no previous file with comments | « no previous file | remoting/android/java/src/org/chromium/chromoting/SessionAuthenticator.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698