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

Unified Diff: remoting/webapp/crd/js/session_connector_impl.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/session_connector_impl.js
diff --git a/remoting/webapp/crd/js/session_connector_impl.js b/remoting/webapp/crd/js/session_connector_impl.js
index fecad39c3ef14fd11421bc78d165f8ca0596e8fb..f00a2e1b5a5d3f59a85cbd1d899cfa050bf3dbeb 100644
--- a/remoting/webapp/crd/js/session_connector_impl.js
+++ b/remoting/webapp/crd/js/session_connector_impl.js
@@ -347,8 +347,9 @@ remoting.SessionConnectorImpl.prototype.connectIT2Me = function(accessCode) {
this.hostId_ = normalizedAccessCode.substring(0, kSupportIdLen);
this.passPhrase_ = normalizedAccessCode;
this.connectionMode_ = remoting.ClientSession.Mode.IT2ME;
- remoting.identity.callWithToken(this.connectIT2MeWithToken_.bind(this),
- this.onError_);
+ remoting.identity.getToken().then(
+ this.connectIT2MeWithToken_.bind(this),
+ remoting.Error.handler(this.onError_));
};
/**
@@ -413,8 +414,9 @@ remoting.SessionConnectorImpl.prototype.connectSignaling_ = function() {
/** @param {string} token */
function connectSignalingWithToken(token) {
- remoting.identity.getUserInfo(
- connectSignalingWithTokenAndUserInfo.bind(null, token), that.onError_);
+ remoting.identity.getUserInfo().then(
+ connectSignalingWithTokenAndUserInfo.bind(null, token),
+ remoting.Error.handler(that.onError_));
}
/**
@@ -424,19 +426,20 @@ remoting.SessionConnectorImpl.prototype.connectSignaling_ = function() {
* and been granted the userinfo.profile permission.
*
* @param {string} token
- * @param {string} email
- * @param {string} fullName
+ * @param {{email: string, name: string}} userInfo
*/
- function connectSignalingWithTokenAndUserInfo(token, email, fullName) {
+ function connectSignalingWithTokenAndUserInfo(token, userInfo) {
that.signalStrategy_.connect(
- remoting.settings.XMPP_SERVER_FOR_CLIENT, email, token);
+ remoting.settings.XMPP_SERVER_FOR_CLIENT, userInfo.email, token);
}
this.signalStrategy_ = remoting.SignalStrategy.create();
this.signalStrategy_.setStateChangedCallback(
this.onSignalingState_.bind(this));
- remoting.identity.callWithToken(connectSignalingWithToken, this.onError_);
+ remoting.identity.getToken().then(
+ connectSignalingWithToken,
+ remoting.Error.handler(this.onError_));
};
/**

Powered by Google App Engine
This is Rietveld 408576698