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

Unified Diff: remoting/webapp/crd/js/host_controller.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/host_controller.js
diff --git a/remoting/webapp/crd/js/host_controller.js b/remoting/webapp/crd/js/host_controller.js
index 3dd8c93558c8d489aa53b8cb9fe2a97724bbc848..99959e292365a97d2beb70a34097b0e2cb912371 100644
--- a/remoting/webapp/crd/js/host_controller.js
+++ b/remoting/webapp/crd/js/host_controller.js
@@ -307,9 +307,10 @@ remoting.HostController.prototype.start = function(hostPin, consent, onDone,
*/
function onHostClientId(
hostName, privateKey, publicKey, hostClientId) {
- remoting.identity.callWithToken(
+ remoting.identity.getToken().then(
doRegisterHost.bind(
- null, hostName, privateKey, publicKey, hostClientId), onError);
+ null, hostName, privateKey, publicKey, hostClientId),
+ remoting.Error.handler(onError));
}
/**
@@ -324,9 +325,10 @@ remoting.HostController.prototype.start = function(hostPin, consent, onDone,
that.hostDaemonFacade_.getHostClientId(
onHostClientId.bind(null, hostName, privateKey, publicKey), onError);
} else {
- remoting.identity.callWithToken(
+ remoting.identity.getToken().then(
doRegisterHost.bind(
- null, hostName, privateKey, publicKey, null), onError);
+ null, hostName, privateKey, publicKey, null),
+ remoting.Error.handler(onError));
}
}
@@ -559,8 +561,9 @@ remoting.HostController.prototype.getClientBaseJid_ = function(
/** @param {string} token */
function connectSignalingWithToken(token) {
- remoting.identity.getEmail(
- connectSignalingWithTokenAndEmail.bind(null, token), onError);
+ remoting.identity.getEmail().then(
+ connectSignalingWithTokenAndEmail.bind(null, token),
+ remoting.Error.handler(onError));
}
/**
@@ -572,7 +575,8 @@ remoting.HostController.prototype.getClientBaseJid_ = function(
remoting.settings.XMPP_SERVER_FOR_CLIENT, email, token);
}
- remoting.identity.callWithToken(connectSignalingWithToken, onError);
+ remoting.identity.getToken().then(
+ connectSignalingWithToken, remoting.Error.handler(onError));
};
/** @type {remoting.HostController} */

Powered by Google App Engine
This is Rietveld 408576698