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 */ |
11 | 11 |
12 'use strict'; | 12 'use strict'; |
13 | 13 |
14 /** @suppress {duplicate} */ | 14 /** @suppress {duplicate} */ |
15 var remoting = remoting || {}; | 15 var remoting = remoting || {}; |
16 | 16 |
17 /** | 17 /** |
18 * @param {Window} sandbox The Javascript Window object representing the | 18 * @param {Window} sandbox The Javascript Window object representing the |
19 * sandboxed WCS driver. | 19 * sandboxed WCS driver. |
20 * @constructor | 20 * @constructor |
21 */ | 21 */ |
22 remoting.WcsSandboxContainer = function(sandbox) { | 22 remoting.WcsSandboxContainer = function(sandbox) { |
23 /** @private */ | 23 /** @private */ |
24 this.sandbox_ = sandbox; | 24 this.sandbox_ = sandbox; |
25 /** @type {?function(string):void} | 25 /** @private {?function(string):void} */ |
26 * @private */ | |
27 this.onConnected_ = null; | 26 this.onConnected_ = null; |
28 /** @type {function(remoting.Error):void} | 27 /** @private {function(remoting.Error):void} */ |
29 * @private */ | |
30 this.onError_ = function(error) {}; | 28 this.onError_ = function(error) {}; |
31 /** @type {?function(string):void} | 29 /** @private {?function(string):void} */ |
32 * @private */ | |
33 this.onIq_ = null; | 30 this.onIq_ = null; |
34 /** @type {Object<number, XMLHttpRequest>} | 31 /** @private {Object<number, XMLHttpRequest>} */ |
35 * @private */ | |
36 this.pendingXhrs_ = {}; | 32 this.pendingXhrs_ = {}; |
37 /** @private */ | 33 /** @private */ |
38 this.localJid_ = ''; | 34 this.localJid_ = ''; |
39 | 35 |
40 /** @private */ | 36 /** @private */ |
41 this.accessTokenRefreshTimerStarted_ = false; | 37 this.accessTokenRefreshTimerStarted_ = false; |
42 | 38 |
43 window.addEventListener('message', this.onMessage_.bind(this), false); | 39 window.addEventListener('message', this.onMessage_.bind(this), false); |
44 | 40 |
45 if (base.isAppsV2()) { | 41 if (base.isAppsV2()) { |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 'xhr': sanitizeXhr_(xhr) | 277 'xhr': sanitizeXhr_(xhr) |
282 }; | 278 }; |
283 this.sandbox_.postMessage(message, '*'); | 279 this.sandbox_.postMessage(message, '*'); |
284 if (xhr.readyState == 4) { | 280 if (xhr.readyState == 4) { |
285 delete this.pendingXhrs_[id]; | 281 delete this.pendingXhrs_[id]; |
286 } | 282 } |
287 } | 283 } |
288 | 284 |
289 /** @type {remoting.WcsSandboxContainer} */ | 285 /** @type {remoting.WcsSandboxContainer} */ |
290 remoting.wcsSandbox = null; | 286 remoting.wcsSandbox = null; |
OLD | NEW |