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 /** @private {remoting.Application.Delegate} */ | 20 /** @private {remoting.Application.Delegate} */ |
34 this.delegate_ = null; | 21 this.delegate_ = null; |
35 | 22 |
36 /** @private {Array<string>} */ | 23 /** @private {Array<string>} */ |
37 this.app_capabilities_ = [ | 24 this.app_capabilities_ = [ |
38 remoting.ClientSession.Capability.SEND_INITIAL_RESOLUTION, | 25 remoting.ClientSession.Capability.SEND_INITIAL_RESOLUTION, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 } | 101 } |
115 }; | 102 }; |
116 | 103 |
117 /** | 104 /** |
118 * Called when a new session has been connected. | 105 * Called when a new session has been connected. |
119 * | 106 * |
120 * @param {remoting.ClientSession} clientSession | 107 * @param {remoting.ClientSession} clientSession |
121 * @return {void} Nothing. | 108 * @return {void} Nothing. |
122 */ | 109 */ |
123 remoting.Application.prototype.onConnected = function(clientSession) { | 110 remoting.Application.prototype.onConnected = function(clientSession) { |
124 remoting.clientSession = clientSession; | |
125 this.sessionConnectedHooks_ = new base.Disposables( | 111 this.sessionConnectedHooks_ = new base.Disposables( |
126 new base.EventHook( | 112 new base.EventHook( |
127 clientSession, 'stateChanged', this.onClientStateChange_.bind(this)), | 113 clientSession, 'stateChanged', this.onClientStateChange_.bind(this)), |
128 new base.RepeatingTimer(this.updateStatistics_.bind(this), 1000) | 114 new base.RepeatingTimer(this.updateStatistics_.bind(this), 1000) |
129 ); | 115 ); |
130 remoting.clipboard.startSession(); | 116 remoting.clipboard.startSession(); |
131 | 117 |
132 this.delegate_.handleConnected(clientSession); | 118 this.delegate_.handleConnected(clientSession); |
133 }; | 119 }; |
134 | 120 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 * Called when an error needs to be displayed to the user. | 333 * Called when an error needs to be displayed to the user. |
348 * | 334 * |
349 * @param {remoting.Error} errorTag The error to be localized and displayed. | 335 * @param {remoting.Error} errorTag The error to be localized and displayed. |
350 * @return {void} Nothing. | 336 * @return {void} Nothing. |
351 */ | 337 */ |
352 remoting.Application.Delegate.prototype.handleError = function(errorTag) {}; | 338 remoting.Application.Delegate.prototype.handleError = function(errorTag) {}; |
353 | 339 |
354 | 340 |
355 /** @type {remoting.Application} */ | 341 /** @type {remoting.Application} */ |
356 remoting.app = null; | 342 remoting.app = null; |
OLD | NEW |