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 sandbox side of the application/sandbox WCS interface, used by the | 8 * The sandbox side of the application/sandbox WCS interface, used by the |
9 * sandbox to exchange messages with the application. | 9 * sandbox to exchange messages with the application. |
10 */ | 10 */ |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 } | 68 } |
69 // The WCS driver JS requires that remoting.wcsLoader be a global | 69 // The WCS driver JS requires that remoting.wcsLoader be a global |
70 // variable, so it can't be a member of this class. | 70 // variable, so it can't be a member of this class. |
71 // TODO(jamiewalch): remoting.wcs doesn't need to be global and should | 71 // TODO(jamiewalch): remoting.wcs doesn't need to be global and should |
72 // be made a member (http://crbug.com/172348). | 72 // be made a member (http://crbug.com/172348). |
73 if (remoting.wcs) { | 73 if (remoting.wcs) { |
74 remoting.wcs.updateAccessToken(token); | 74 remoting.wcs.updateAccessToken(token); |
75 } else if (!remoting.wcsLoader) { | 75 } else if (!remoting.wcsLoader) { |
76 remoting.wcsLoader = new remoting.WcsLoader(); | 76 remoting.wcsLoader = new remoting.WcsLoader(); |
77 remoting.wcsLoader.start(token, | 77 remoting.wcsLoader.start(token, |
78 this.onReady_.bind(this), | 78 this.onLocalJid_.bind(this), |
79 this.onError_.bind(this)); | 79 this.onError_.bind(this)); |
80 } | 80 } |
81 break; | 81 break; |
82 | 82 |
83 case 'xhrStateChange': | 83 case 'xhrStateChange': |
84 /** @type {number} */ | 84 /** @type {number} */ |
85 var id = event.data['id']; | 85 var id = event.data['id']; |
86 if (id === undefined) { | 86 if (id === undefined) { |
87 console.error('xhrStateChange: missing id.'); | 87 console.error('xhrStateChange: missing id.'); |
88 break; | 88 break; |
(...skipping 25 matching lines...) Expand all Loading... |
114 } | 114 } |
115 }; | 115 }; |
116 | 116 |
117 /** | 117 /** |
118 * Callback method to indicate that the WCS driver has loaded and provide the | 118 * Callback method to indicate that the WCS driver has loaded and provide the |
119 * full JID of the client. | 119 * full JID of the client. |
120 * | 120 * |
121 * @param {string} clientJid The full JID of the WCS client. | 121 * @param {string} clientJid The full JID of the WCS client. |
122 * @private | 122 * @private |
123 */ | 123 */ |
124 remoting.WcsSandboxContent.prototype.onReady_ = function(clientJid) { | 124 remoting.WcsSandboxContent.prototype.onLocalJid_ = function(clientJid) { |
125 remoting.wcs.setOnIq(this.onIq_.bind(this)); | 125 remoting.wcs.setOnIq(this.onIq_.bind(this)); |
126 var message = { | 126 var message = { |
127 'command': 'onReady', | 127 'command': 'onLocalJid', |
128 'clientJid': clientJid | 128 'clientJid': clientJid |
129 }; | 129 }; |
130 this.parentWindow_.postMessage(message, '*'); | 130 this.parentWindow_.postMessage(message, '*'); |
131 }; | 131 }; |
132 | 132 |
133 /** | 133 /** |
134 * Callback method to indicate that something went wrong loading the WCS driver. | 134 * Callback method to indicate that something went wrong loading the WCS driver. |
135 * | 135 * |
136 * @param {remoting.Error} error Details of the error. | 136 * @param {remoting.Error} error Details of the error. |
137 * @private | 137 * @private |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 }; | 214 }; |
215 | 215 |
216 remoting.settings = new remoting.Settings(); | 216 remoting.settings = new remoting.Settings(); |
217 remoting.sandboxContent = new remoting.WcsSandboxContent(); | 217 remoting.sandboxContent = new remoting.WcsSandboxContent(); |
218 } | 218 } |
219 | 219 |
220 window.addEventListener('load', onSandboxInit, false); | 220 window.addEventListener('load', onSandboxInit, false); |
221 | 221 |
222 /** @type {remoting.WcsSandboxContent} */ | 222 /** @type {remoting.WcsSandboxContent} */ |
223 remoting.sandboxContent = null; | 223 remoting.sandboxContent = null; |
OLD | NEW |