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

Side by Side Diff: remoting/webapp/crd/js/wcs_sandbox_container.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 unified diff | Download patch
OLDNEW
1 /* Copyright 2013 The Chromium Authors. All rights reserved. 1 /* Copyright 2013 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 /** 6 /**
7 * @fileoverview 7 * @fileoverview
8 * The application side of the application/sandbox WCS interface, used by the 8 * The application side of the application/sandbox WCS interface, used by the
9 * application to exchange messages with the sandbox. 9 * application to exchange messages with the sandbox.
10 */ 10 */
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 this.refreshAccessToken_(); 90 this.refreshAccessToken_();
91 setInterval(this.refreshAccessToken_.bind(this), 60 * 1000); 91 setInterval(this.refreshAccessToken_.bind(this), 60 * 1000);
92 this.accessTokenRefreshTimerStarted_ = true; 92 this.accessTokenRefreshTimerStarted_ = true;
93 } 93 }
94 94
95 /** 95 /**
96 * @private 96 * @private
97 * @return {void} Nothing. 97 * @return {void} Nothing.
98 */ 98 */
99 remoting.WcsSandboxContainer.prototype.refreshAccessToken_ = function() { 99 remoting.WcsSandboxContainer.prototype.refreshAccessToken_ = function() {
100 remoting.identity.callWithToken( 100 remoting.identity.getToken().then(
101 this.setAccessToken_.bind(this), this.onError_); 101 this.setAccessToken_.bind(this),
102 remoting.Error.handler(this.onError_));
102 }; 103 };
103 104
104 /** 105 /**
105 * @private 106 * @private
106 * @param {string} token The access token. 107 * @param {string} token The access token.
107 * @return {void} 108 * @return {void}
108 */ 109 */
109 remoting.WcsSandboxContainer.prototype.setAccessToken_ = function(token) { 110 remoting.WcsSandboxContainer.prototype.setAccessToken_ = function(token) {
110 var message = { 111 var message = {
111 'command': 'setAccessToken', 112 'command': 'setAccessToken',
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 'xhr': sanitizeXhr_(xhr) 281 'xhr': sanitizeXhr_(xhr)
281 }; 282 };
282 this.sandbox_.postMessage(message, '*'); 283 this.sandbox_.postMessage(message, '*');
283 if (xhr.readyState == 4) { 284 if (xhr.readyState == 4) {
284 delete this.pendingXhrs_[id]; 285 delete this.pendingXhrs_[id];
285 } 286 }
286 } 287 }
287 288
288 /** @type {remoting.WcsSandboxContainer} */ 289 /** @type {remoting.WcsSandboxContainer} */
289 remoting.wcsSandbox = null; 290 remoting.wcsSandbox = null;
OLDNEW
« no previous file with comments | « remoting/webapp/crd/js/session_connector_impl.js ('k') | remoting/webapp/unittests/apps_v2_migration_unittest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698