OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * This class implements the functionality that is specific to application | 7 * This class implements the functionality that is specific to application |
8 * remoting ("AppRemoting" or AR). | 8 * remoting ("AppRemoting" or AR). |
9 */ | 9 */ |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 /** @private {remoting.ApplicationContextMenu} */ | 25 /** @private {remoting.ApplicationContextMenu} */ |
26 this.contextMenu_ = null; | 26 this.contextMenu_ = null; |
27 | 27 |
28 /** @private {remoting.KeyboardLayoutsMenu} */ | 28 /** @private {remoting.KeyboardLayoutsMenu} */ |
29 this.keyboardLayoutsMenu_ = null; | 29 this.keyboardLayoutsMenu_ = null; |
30 | 30 |
31 /** @private {remoting.WindowActivationMenu} */ | 31 /** @private {remoting.WindowActivationMenu} */ |
32 this.windowActivationMenu_ = null; | 32 this.windowActivationMenu_ = null; |
33 | 33 |
34 /** @private {base.RepeatingTimer} */ | 34 /** @private {base.RepeatingTimer} */ |
35 this.pingTimer_ = null; | 35 this.pingTimer_ = null; |
| 36 |
| 37 /** @private {remoting.DesktopConnectedView} */ |
| 38 this.connectedView_ = null; |
36 }; | 39 }; |
37 | 40 |
38 /** | 41 /** |
39 * Type definition for the RunApplicationResponse returned by the API. | 42 * Type definition for the RunApplicationResponse returned by the API. |
40 * | 43 * |
41 * @constructor | 44 * @constructor |
42 * @private | 45 * @private |
43 */ | 46 */ |
44 remoting.AppRemoting.AppHostResponse = function() { | 47 remoting.AppRemoting.AppHostResponse = function() { |
45 /** @type {string} */ | 48 /** @type {string} */ |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 238 |
236 remoting.app.getSessionConnector().registerProtocolExtension(this); | 239 remoting.app.getSessionConnector().registerProtocolExtension(this); |
237 | 240 |
238 var clientSession = connectionInfo.session(); | 241 var clientSession = connectionInfo.session(); |
239 // Set up a ping at 10-second intervals to test the connection speed. | 242 // Set up a ping at 10-second intervals to test the connection speed. |
240 var CONNECTION_SPEED_PING_INTERVAL = 10 * 1000; | 243 var CONNECTION_SPEED_PING_INTERVAL = 10 * 1000; |
241 this.pingTimer_ = new base.RepeatingTimer(function () { | 244 this.pingTimer_ = new base.RepeatingTimer(function () { |
242 var message = { timestamp: new Date().getTime() }; | 245 var message = { timestamp: new Date().getTime() }; |
243 clientSession.sendClientMessage('pingRequest', JSON.stringify(message)); | 246 clientSession.sendClientMessage('pingRequest', JSON.stringify(message)); |
244 }, CONNECTION_SPEED_PING_INTERVAL); | 247 }, CONNECTION_SPEED_PING_INTERVAL); |
| 248 |
| 249 // TODO(kelvinp): Move all app remoting specific logic into |
| 250 // remoting.AppRemotingView. |
| 251 this.connectedView_ = new remoting.DesktopConnectedView( |
| 252 document.getElementById('client-container'), connectionInfo, |
| 253 this.getDefaultRemapKeys()); |
245 }; | 254 }; |
246 | 255 |
247 /** | 256 /** |
248 * Called when the current session has been disconnected. | 257 * Called when the current session has been disconnected. |
249 * | 258 * |
250 * @return {void} Nothing. | 259 * @return {void} Nothing. |
251 */ | 260 */ |
252 remoting.AppRemoting.prototype.handleDisconnected = function() { | 261 remoting.AppRemoting.prototype.handleDisconnected = function() { |
253 // Cancel the ping when the connection closes. | 262 // Cancel the ping when the connection closes. |
254 base.dispose(this.pingTimer_); | 263 base.dispose(this.pingTimer_); |
255 this.pingTimer_ = null; | 264 this.pingTimer_ = null; |
256 | 265 |
| 266 base.dispose(this.connectedView_); |
| 267 this.connectedView_ = null; |
| 268 |
257 chrome.app.window.current().close(); | 269 chrome.app.window.current().close(); |
258 }; | 270 }; |
259 | 271 |
260 /** | 272 /** |
261 * Called when the current session's connection has failed. | 273 * Called when the current session's connection has failed. |
262 * | 274 * |
263 * @param {remoting.SessionConnector} connector | 275 * @param {remoting.SessionConnector} connector |
264 * @param {!remoting.Error} error | 276 * @param {!remoting.Error} error |
265 * @return {void} Nothing. | 277 * @return {void} Nothing. |
266 */ | 278 */ |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 chrome.i18n.getMessage(/*i18n-content*/'CONNECTION_FAILED'), | 369 chrome.i18n.getMessage(/*i18n-content*/'CONNECTION_FAILED'), |
358 chrome.i18n.getMessage(error.getTag())); | 370 chrome.i18n.getMessage(error.getTag())); |
359 }; | 371 }; |
360 | 372 |
361 /** | 373 /** |
362 * Close the loading window before exiting. | 374 * Close the loading window before exiting. |
363 */ | 375 */ |
364 remoting.AppRemoting.prototype.handleExit = function() { | 376 remoting.AppRemoting.prototype.handleExit = function() { |
365 remoting.LoadingWindow.close(); | 377 remoting.LoadingWindow.close(); |
366 }; | 378 }; |
OLD | NEW |