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

Unified Diff: remoting/webapp/app_remoting/js/app_connected_view.js

Issue 1123183005: Respect opt_scopes in getNewToken. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « no previous file | remoting/webapp/crd/js/identity.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/app_remoting/js/app_connected_view.js
diff --git a/remoting/webapp/app_remoting/js/app_connected_view.js b/remoting/webapp/app_remoting/js/app_connected_view.js
index 73c308840c75abfff56082c91db00444f2c314d0..34a195137371225933da5e1d53d9ee12662535ca 100644
--- a/remoting/webapp/app_remoting/js/app_connected_view.js
+++ b/remoting/webapp/app_remoting/js/app_connected_view.js
@@ -238,11 +238,17 @@ remoting.AppConnectedView.prototype.sendGoogleDriveAccessToken_ =
'https://www.googleapis.com/auth/drive'
];
remoting.identity.getNewToken(googleDriveScopes).then(
- function(/** string */ token){
+ function(/** string */ token) {
+ base.debug.assert(token !== previousToken_);
+ previousToken_ = token;
sendExtensionMessage('accessToken', token);
}).catch(remoting.Error.handler(function(/** remoting.Error */ error) {
console.log('Failed to refresh access token: ' + error.toString());
}));
};
+// The access token last received from getNewToken. Saved to ensure that we
+// get a fresh token each time.
+var previousToken_ = '';
kelvinp 2015/05/11 17:17:33 This can be moved inside the scope of sendGoogleDr
Jamie 2015/05/11 17:23:08 I think it's clearer as a global. Javascript scopi
+
})();
« no previous file with comments | « no previous file | remoting/webapp/crd/js/identity.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698