OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chromoting; | 5 package org.chromium.chromoting; |
6 | 6 |
7 import android.accounts.Account; | 7 import android.accounts.Account; |
8 import android.accounts.AccountManager; | 8 import android.accounts.AccountManager; |
9 import android.accounts.AccountManagerCallback; | 9 import android.accounts.AccountManagerCallback; |
10 import android.accounts.AccountManagerFuture; | 10 import android.accounts.AccountManagerFuture; |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 } | 276 } |
277 | 277 |
278 /** Called when the user touches hyperlinked text. */ | 278 /** Called when the user touches hyperlinked text. */ |
279 @Override | 279 @Override |
280 public void onClick(View view) { | 280 public void onClick(View view) { |
281 HelpActivity.launch(this, HOST_SETUP_URL); | 281 HelpActivity.launch(this, HOST_SETUP_URL); |
282 } | 282 } |
283 | 283 |
284 /** Called when the user taps on a host entry. */ | 284 /** Called when the user taps on a host entry. */ |
285 public void connectToHost(HostInfo host) { | 285 public void connectToHost(HostInfo host) { |
286 mProgressIndicator = ProgressDialog.show(this, | 286 mProgressIndicator = ProgressDialog.show( |
287 host.name, getString(R.string.footer_connecting), true, true, | 287 this, |
288 new DialogInterface.OnCancelListener() { | 288 host.name, |
289 @Override | 289 getString(R.string.footer_connecting), |
290 public void onCancel(DialogInterface dialog) { | 290 true, |
291 JniInterface.disconnectFromHost(); | 291 true, |
292 mTokenFetcher = null; | 292 new DialogInterface.OnCancelListener() { |
293 } | 293 @Override |
294 }); | 294 public void onCancel(DialogInterface dialog) { |
| 295 JniInterface.disconnectFromHost(); |
| 296 mTokenFetcher = null; |
| 297 } |
| 298 }); |
295 SessionConnector connector = new SessionConnector(this, this, mHostListL
oader); | 299 SessionConnector connector = new SessionConnector(this, this, mHostListL
oader); |
296 assert mTokenFetcher == null; | 300 assert mTokenFetcher == null; |
297 mTokenFetcher = createTokenFetcher(host); | 301 mTokenFetcher = createTokenFetcher(host); |
298 connector.connectToHost(mAccount.name, mToken, host); | 302 connector.connectToHost(mAccount.name, mToken, host); |
299 } | 303 } |
300 | 304 |
301 private void refreshHostList() { | 305 private void refreshHostList() { |
302 if (mWaitingForAuthToken) { | 306 if (mWaitingForAuthToken) { |
303 return; | 307 return; |
304 } | 308 } |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 } | 495 } |
492 }; | 496 }; |
493 return new ThirdPartyTokenFetcher(this, host.getTokenUrlPatterns(), call
back); | 497 return new ThirdPartyTokenFetcher(this, host.getTokenUrlPatterns(), call
back); |
494 } | 498 } |
495 | 499 |
496 public void fetchThirdPartyToken(String tokenUrl, String clientId, String sc
ope) { | 500 public void fetchThirdPartyToken(String tokenUrl, String clientId, String sc
ope) { |
497 assert mTokenFetcher != null; | 501 assert mTokenFetcher != null; |
498 mTokenFetcher.fetchToken(tokenUrl, clientId, scope); | 502 mTokenFetcher.fetchToken(tokenUrl, clientId, scope); |
499 } | 503 } |
500 } | 504 } |
OLD | NEW |