Chromium Code Reviews| 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..ce36ab41a8a6af41af1c477518cc619ceb19a48b 100644 |
| --- a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java |
| +++ b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java |
| @@ -90,8 +90,8 @@ 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; |
| + /** Object for handling the Intent received when using third-party session authentication. */ |
|
Sergey Ulanov
2015/03/18 17:55:03
I don't think this is a good description. Handling
Lambros
2015/03/18 18:45:19
Done.
|
| + private SessionAuthenticator mAuthenticator; |
| /** |
| * This is set when receiving an authentication error from the HostListLoader. If that occurs, |
| @@ -214,10 +214,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 +322,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 +507,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); |
| - } |
| } |