| 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 * Interface abstracting the Application functionality. | 7 * Interface abstracting the Application functionality. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 'use strict'; | 10 'use strict'; |
| 11 | 11 |
| 12 /** @suppress {duplicate} */ | 12 /** @suppress {duplicate} */ |
| 13 var remoting = remoting || {}; | 13 var remoting = remoting || {}; |
| 14 | 14 |
| 15 /** | 15 /** |
| 16 * @type {remoting.ClientSession} The client session object, set once the | |
| 17 * connector has invoked its onOk callback. | |
| 18 * TODO(garykac): Make clientSession a member var of Application. | |
| 19 */ | |
| 20 remoting.clientSession = null; | |
| 21 | |
| 22 /** | |
| 23 * @type {remoting.DesktopConnectedView} The client session view object, set | |
| 24 * once the connector has invoked its onOk callback. | |
| 25 */ | |
| 26 remoting.desktopConnectedView = null; | |
| 27 | |
| 28 /** | |
| 29 * @param {Array<string>} app_capabilities Array of application capabilities. | 16 * @param {Array<string>} app_capabilities Array of application capabilities. |
| 30 * @constructor | 17 * @constructor |
| 31 */ | 18 */ |
| 32 remoting.Application = function(app_capabilities) { | 19 remoting.Application = function(app_capabilities) { |
| 33 /** | 20 /** |
| 34 * @type {remoting.Application.Delegate} | 21 * @type {remoting.Application.Delegate} |
| 35 * @private | 22 * @private |
| 36 */ | 23 */ |
| 37 this.delegate_ = null; | 24 this.delegate_ = null; |
| 38 | 25 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 104 } |
| 118 }; | 105 }; |
| 119 | 106 |
| 120 /** | 107 /** |
| 121 * Called when a new session has been connected. | 108 * Called when a new session has been connected. |
| 122 * | 109 * |
| 123 * @param {remoting.ClientSession} clientSession | 110 * @param {remoting.ClientSession} clientSession |
| 124 * @return {void} Nothing. | 111 * @return {void} Nothing. |
| 125 */ | 112 */ |
| 126 remoting.Application.prototype.onConnected = function(clientSession) { | 113 remoting.Application.prototype.onConnected = function(clientSession) { |
| 127 remoting.clientSession = clientSession; | |
| 128 this.sessionConnectedHooks_ = new base.Disposables( | 114 this.sessionConnectedHooks_ = new base.Disposables( |
| 129 new base.EventHook( | 115 new base.EventHook( |
| 130 clientSession, 'stateChanged', this.onClientStateChange_.bind(this)), | 116 clientSession, 'stateChanged', this.onClientStateChange_.bind(this)), |
| 131 new base.RepeatingTimer(this.updateStatistics_.bind(this), 1000) | 117 new base.RepeatingTimer(this.updateStatistics_.bind(this), 1000) |
| 132 ); | 118 ); |
| 133 remoting.clipboard.startSession(); | 119 remoting.clipboard.startSession(); |
| 134 | 120 |
| 135 this.delegate_.handleConnected(clientSession); | 121 this.delegate_.handleConnected(clientSession); |
| 136 }; | 122 }; |
| 137 | 123 |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 * Called when an error needs to be displayed to the user. | 319 * Called when an error needs to be displayed to the user. |
| 334 * | 320 * |
| 335 * @param {remoting.Error} errorTag The error to be localized and displayed. | 321 * @param {remoting.Error} errorTag The error to be localized and displayed. |
| 336 * @return {void} Nothing. | 322 * @return {void} Nothing. |
| 337 */ | 323 */ |
| 338 remoting.Application.Delegate.prototype.handleError = function(errorTag) {}; | 324 remoting.Application.Delegate.prototype.handleError = function(errorTag) {}; |
| 339 | 325 |
| 340 | 326 |
| 341 /** @type {remoting.Application} */ | 327 /** @type {remoting.Application} */ |
| 342 remoting.app = null; | 328 remoting.app = null; |
| OLD | NEW |