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

Unified Diff: remoting/webapp/crd/js/crd_event_handlers.js

Issue 937593002: Changed identity API to use promises instead of callbacks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
Index: remoting/webapp/crd/js/crd_event_handlers.js
diff --git a/remoting/webapp/crd/js/crd_event_handlers.js b/remoting/webapp/crd/js/crd_event_handlers.js
index 9196e6b3792fc4bae2e7d473d57ada92f35bf7f1..74fc5996081f992b431dbf1829a4fec455205855 100644
--- a/remoting/webapp/crd/js/crd_event_handlers.js
+++ b/remoting/webapp/crd/js/crd_event_handlers.js
@@ -15,12 +15,11 @@ remoting.initElementEventHandlers = function() {
// We don't need a token until we authenticate, but asking for one here
// handles the token-expired case earlier, avoiding asking the user for
// the access code both before and after re-authentication.
- remoting.identity.callWithToken(
- /** @param {string} token */
- function(token) {
+ remoting.identity.getToken().
+ then(function(token) {
remoting.setMode(remoting.AppMode.CLIENT_UNCONNECTED);
- },
- remoting.showErrorMessage);
+ }).
+ catch(remoting.Error.handler(remoting.showErrorMessage));
};
var goFinishedIT2Me = function() {
if (remoting.currentMode == remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME) {

Powered by Google App Engine
This is Rietveld 408576698