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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | remoting/webapp/crd/js/identity.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * Implements a basic UX control for a connected app remoting session. 7 * Implements a basic UX control for a connected app remoting session.
8 */ 8 */
9 9
10 /** @suppress {duplicate} */ 10 /** @suppress {duplicate} */
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 * @param {function(string, string)} sendExtensionMessage 231 * @param {function(string, string)} sendExtensionMessage
232 * @private 232 * @private
233 */ 233 */
234 remoting.AppConnectedView.prototype.sendGoogleDriveAccessToken_ = 234 remoting.AppConnectedView.prototype.sendGoogleDriveAccessToken_ =
235 function(sendExtensionMessage) { 235 function(sendExtensionMessage) {
236 var googleDriveScopes = [ 236 var googleDriveScopes = [
237 'https://docs.google.com/feeds/', 237 'https://docs.google.com/feeds/',
238 'https://www.googleapis.com/auth/drive' 238 'https://www.googleapis.com/auth/drive'
239 ]; 239 ];
240 remoting.identity.getNewToken(googleDriveScopes).then( 240 remoting.identity.getNewToken(googleDriveScopes).then(
241 function(/** string */ token){ 241 function(/** string */ token) {
242 base.debug.assert(token !== previousToken_);
243 previousToken_ = token;
242 sendExtensionMessage('accessToken', token); 244 sendExtensionMessage('accessToken', token);
243 }).catch(remoting.Error.handler(function(/** remoting.Error */ error) { 245 }).catch(remoting.Error.handler(function(/** remoting.Error */ error) {
244 console.log('Failed to refresh access token: ' + error.toString()); 246 console.log('Failed to refresh access token: ' + error.toString());
245 })); 247 }));
246 }; 248 };
247 249
250 // The access token last received from getNewToken. Saved to ensure that we
251 // get a fresh token each time.
252 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
253
248 })(); 254 })();
OLDNEW
« 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