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

Side by Side Diff: remoting/webapp/base/js/identity.js

Issue 1123183005: Respect opt_scopes in getNewToken. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. 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 | « remoting/webapp/app_remoting/js/app_connected_view.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 * Wrapper class for Chrome's identity API. 7 * Wrapper class for Chrome's identity API.
8 */ 8 */
9 /** @suppress {duplicate} */ 9 /** @suppress {duplicate} */
10 var remoting = remoting || {}; 10 var remoting = remoting || {};
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 * @return {!Promise<string>} A promise resolved with an access token 88 * @return {!Promise<string>} A promise resolved with an access token
89 * or rejected with a remoting.Error. 89 * or rejected with a remoting.Error.
90 */ 90 */
91 remoting.Identity.prototype.getNewToken = function(opt_scopes) { 91 remoting.Identity.prototype.getNewToken = function(opt_scopes) {
92 /** @type {remoting.Identity} */ 92 /** @type {remoting.Identity} */
93 var that = this; 93 var that = this;
94 94
95 return this.getToken(opt_scopes).then(function(/** string */ token) { 95 return this.getToken(opt_scopes).then(function(/** string */ token) {
96 return new Promise(function(resolve, reject) { 96 return new Promise(function(resolve, reject) {
97 chrome.identity.removeCachedAuthToken({'token': token }, function() { 97 chrome.identity.removeCachedAuthToken({'token': token }, function() {
98 resolve(that.getToken()); 98 resolve(that.getToken(opt_scopes));
99 }); 99 });
100 }); 100 });
101 }); 101 });
102 }; 102 };
103 103
104 /** 104 /**
105 * Removes the cached auth token, if any. 105 * Removes the cached auth token, if any.
106 * 106 *
107 * @return {!Promise<null>} A promise resolved with the operation completes. 107 * @return {!Promise<null>} A promise resolved with the operation completes.
108 */ 108 */
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 238
239 /** 239 /**
240 * @param {Array<string>=} opt_scopes 240 * @param {Array<string>=} opt_scopes
241 * @return {string} 241 * @return {string}
242 */ 242 */
243 function getScopesKey(opt_scopes) { 243 function getScopesKey(opt_scopes) {
244 return opt_scopes ? JSON.stringify(opt_scopes) : ''; 244 return opt_scopes ? JSON.stringify(opt_scopes) : '';
245 } 245 }
246 246
247 })(); 247 })();
OLDNEW
« no previous file with comments | « remoting/webapp/app_remoting/js/app_connected_view.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698