| 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 {remoting.AppConnectedView} */ | 
| 35   this.pingTimer_ = null; |  | 
| 36 |  | 
| 37   /** @private {remoting.DesktopConnectedView} */ |  | 
| 38   this.connectedView_ = null; | 35   this.connectedView_ = null; | 
| 39 }; | 36 }; | 
| 40 | 37 | 
| 41 /** | 38 /** | 
| 42  * Type definition for the RunApplicationResponse returned by the API. | 39  * Type definition for the RunApplicationResponse returned by the API. | 
| 43  * | 40  * | 
| 44  * @constructor | 41  * @constructor | 
| 45  * @private | 42  * @private | 
| 46  */ | 43  */ | 
| 47 remoting.AppRemoting.AppHostResponse = function() { | 44 remoting.AppRemoting.AppHostResponse = function() { | 
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 219 remoting.AppRemoting.prototype.handleConnected = function(connectionInfo) { | 216 remoting.AppRemoting.prototype.handleConnected = function(connectionInfo) { | 
| 220   remoting.identity.getUserInfo().then( | 217   remoting.identity.getUserInfo().then( | 
| 221       function(userInfo) { | 218       function(userInfo) { | 
| 222         remoting.clientSession.sendClientMessage( | 219         remoting.clientSession.sendClientMessage( | 
| 223             'setUserDisplayInfo', | 220             'setUserDisplayInfo', | 
| 224             JSON.stringify({fullName: userInfo.name})); | 221             JSON.stringify({fullName: userInfo.name})); | 
| 225       }); | 222       }); | 
| 226 | 223 | 
| 227   remoting.app.getSessionConnector().registerProtocolExtension(this); | 224   remoting.app.getSessionConnector().registerProtocolExtension(this); | 
| 228 | 225 | 
| 229   var clientSession = connectionInfo.session(); | 226   this.connectedView_ = new remoting.AppConnectedView( | 
| 230   // Set up a ping at 10-second intervals to test the connection speed. |  | 
| 231   var CONNECTION_SPEED_PING_INTERVAL = 10 * 1000; |  | 
| 232   this.pingTimer_ = new base.RepeatingTimer(function () { |  | 
| 233     var message = { timestamp: new Date().getTime() }; |  | 
| 234     clientSession.sendClientMessage('pingRequest', JSON.stringify(message)); |  | 
| 235   }, CONNECTION_SPEED_PING_INTERVAL); |  | 
| 236 |  | 
| 237   // TODO(kelvinp): Move all app remoting specific logic into |  | 
| 238   // remoting.AppRemotingView. |  | 
| 239   this.connectedView_ = new remoting.DesktopConnectedView( |  | 
| 240       document.getElementById('client-container'), connectionInfo); | 227       document.getElementById('client-container'), connectionInfo); | 
| 241 | 228 | 
| 242   // Map Cmd to Ctrl on Mac since hosts typically use Ctrl for keyboard | 229   // Map Cmd to Ctrl on Mac since hosts typically use Ctrl for keyboard | 
| 243   // shortcuts, but we want them to act as natively as possible. | 230   // shortcuts, but we want them to act as natively as possible. | 
| 244   if (remoting.platformIsMac()) { | 231   if (remoting.platformIsMac()) { | 
| 245     connectionInfo.plugin().setRemapKeys('0x0700e3>0x0700e0,0x0700e7>0x0700e4'); | 232     connectionInfo.plugin().setRemapKeys('0x0700e3>0x0700e0,0x0700e7>0x0700e4'); | 
| 246   } | 233   } | 
| 247 }; | 234 }; | 
| 248 | 235 | 
| 249 /** | 236 /** | 
| 250  * Called when the current session has been disconnected. | 237  * Called when the current session has been disconnected. | 
| 251  * | 238  * | 
| 252  * @return {void} Nothing. | 239  * @return {void} Nothing. | 
| 253  */ | 240  */ | 
| 254 remoting.AppRemoting.prototype.handleDisconnected = function() { | 241 remoting.AppRemoting.prototype.handleDisconnected = function() { | 
| 255   // Cancel the ping when the connection closes. |  | 
| 256   base.dispose(this.pingTimer_); |  | 
| 257   this.pingTimer_ = null; |  | 
| 258 |  | 
| 259   base.dispose(this.connectedView_); | 242   base.dispose(this.connectedView_); | 
| 260   this.connectedView_ = null; | 243   this.connectedView_ = null; | 
| 261 | 244 | 
| 262   chrome.app.window.current().close(); | 245   chrome.app.window.current().close(); | 
| 263 }; | 246 }; | 
| 264 | 247 | 
| 265 /** | 248 /** | 
| 266  * Called when the current session's connection has failed. | 249  * Called when the current session's connection has failed. | 
| 267  * | 250  * | 
| 268  * @param {remoting.SessionConnector} connector | 251  * @param {remoting.SessionConnector} connector | 
| 269  * @param {!remoting.Error} error | 252  * @param {!remoting.Error} error | 
| 270  * @return {void} Nothing. | 253  * @return {void} Nothing. | 
| 271  */ | 254  */ | 
| 272 remoting.AppRemoting.prototype.handleConnectionFailed = function( | 255 remoting.AppRemoting.prototype.handleConnectionFailed = function( | 
| 273     connector, error) { | 256     connector, error) { | 
| 274   this.handleError(error); | 257   this.handleError(error); | 
| 275 }; | 258 }; | 
| 276 | 259 | 
| 277 /** |  | 
| 278  * Called when the current session has reached the point where the host has |  | 
| 279  * started streaming video frames to the client. |  | 
| 280  * |  | 
| 281  * @return {void} Nothing. |  | 
| 282  */ |  | 
| 283 remoting.AppRemoting.prototype.handleVideoStreamingStarted = function() { |  | 
| 284   remoting.LoadingWindow.close(); |  | 
| 285 }; |  | 
| 286 |  | 
| 287 |  | 
| 288 /** @return {Array<string>} */ | 260 /** @return {Array<string>} */ | 
| 289 remoting.AppRemoting.prototype.getExtensionTypes = function() { | 261 remoting.AppRemoting.prototype.getExtensionTypes = function() { | 
| 290   return ['openURL', 'onWindowRemoved', 'onWindowAdded', | 262   return ['openURL', 'onWindowRemoved', 'onWindowAdded', | 
| 291           'onAllWindowsMinimized', 'setKeyboardLayouts', 'pingResponse']; | 263           'onAllWindowsMinimized', 'setKeyboardLayouts', 'pingResponse']; | 
| 292 }; | 264 }; | 
| 293 | 265 | 
| 294 /** | 266 /** | 
| 295  * @param {function(string,string)} sendMessageToHost Callback to send a message | 267  * @param {function(string,string)} sendMessageToHost Callback to send a message | 
| 296  *     to the host. | 268  *     to the host. | 
| 297  */ | 269  */ | 
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 362       chrome.i18n.getMessage(/*i18n-content*/'CONNECTION_FAILED'), | 334       chrome.i18n.getMessage(/*i18n-content*/'CONNECTION_FAILED'), | 
| 363       chrome.i18n.getMessage(error.getTag())); | 335       chrome.i18n.getMessage(error.getTag())); | 
| 364 }; | 336 }; | 
| 365 | 337 | 
| 366 /** | 338 /** | 
| 367  * Close the loading window before exiting. | 339  * Close the loading window before exiting. | 
| 368  */ | 340  */ | 
| 369 remoting.AppRemoting.prototype.handleExit = function() { | 341 remoting.AppRemoting.prototype.handleExit = function() { | 
| 370   remoting.LoadingWindow.close(); | 342   remoting.LoadingWindow.close(); | 
| 371 }; | 343 }; | 
| OLD | NEW | 
|---|