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

Unified Diff: remoting/webapp/base/js/auth_init.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: fixed bad merge 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
« no previous file with comments | « remoting/webapp/base/js/auth_dialog.js ('k') | remoting/webapp/base/js/base.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/base/js/auth_init.js
diff --git a/remoting/webapp/base/js/auth_init.js b/remoting/webapp/base/js/auth_init.js
index 8312c31077fa08056665fefa3fe578a08d562f02..c67e454143a62a48befa3f45afd8c475fbe29f5d 100644
--- a/remoting/webapp/base/js/auth_init.js
+++ b/remoting/webapp/base/js/auth_init.js
@@ -42,8 +42,12 @@ remoting.initIdentity = function(onUserInfoAvailable) {
}
}
- remoting.identity.getUserInfo(onUserInfoAvailable,
- onGetIdentityInfoError);
+ remoting.identity.getUserInfo().then(function(userInfo) {
+ onUserInfoAvailable(userInfo.email, userInfo.name);
+ }).catch(function(error) {
+ onGetIdentityInfoError(
+ /** @type {remoting.Error} */ (error));
+ });
};
/**
@@ -52,7 +56,7 @@ remoting.initIdentity = function(onUserInfoAvailable) {
* @return {void} Nothing.
*/
remoting.handleAuthFailureAndRelaunch = function() {
- remoting.identity.removeCachedAuthToken(function(){
+ remoting.identity.removeCachedAuthToken().then(function(){
if (base.isAppsV2()) {
base.Ipc.invoke('remoting.ActivationHandler.restart',
chrome.app.window.current().id);
« no previous file with comments | « remoting/webapp/base/js/auth_dialog.js ('k') | remoting/webapp/base/js/base.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698