| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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; |
| OLD | NEW |