Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: remoting/webapp/base/js/application.js

Issue 981083002: [Chromoting] Move ownership of ClientPlugin into SessionConnector. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 16 * @type {remoting.ClientSession} The client session object, set once the
17 * connector has invoked its onOk callback. 17 * connector has invoked its onOk callback.
18 * TODO(garykac): Make clientSession a member var of Application. 18 * TODO(garykac): Make clientSession a member var of Application.
19 */ 19 */
20 remoting.clientSession = null; 20 remoting.clientSession = null;
kelvinp 2015/03/06 02:58:37 Please also moves it to sessionConnector, if you a
garykac 2015/03/06 23:38:33 Done.
21 21
22 /** 22 /**
23 * @type {remoting.DesktopConnectedView} The client session view object, set 23 * @type {remoting.DesktopConnectedView} The client session view object, set
24 * once the connector has invoked its onOk callback. 24 * once the connector has invoked its onOk callback.
25 */ 25 */
26 remoting.desktopConnectedView = null; 26 remoting.desktopConnectedView = null;
27 27
28 /** 28 /**
29 * @param {Array<string>} app_capabilities Array of application capabilities. 29 * @param {Array<string>} app_capabilities Array of application capabilities.
30 * @constructor 30 * @constructor
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 } 117 }
118 }; 118 };
119 119
120 /** 120 /**
121 * Called when a new session has been connected. 121 * Called when a new session has been connected.
122 * 122 *
123 * @param {remoting.ClientSession} clientSession 123 * @param {remoting.ClientSession} clientSession
124 * @return {void} Nothing. 124 * @return {void} Nothing.
125 */ 125 */
126 remoting.Application.prototype.onConnected = function(clientSession) { 126 remoting.Application.prototype.onConnected = function(clientSession) {
127 remoting.clientSession = clientSession;
128 this.sessionConnectedHooks_ = new base.Disposables( 127 this.sessionConnectedHooks_ = new base.Disposables(
129 new base.EventHook( 128 new base.EventHook(
130 clientSession, 'stateChanged', this.onClientStateChange_.bind(this)), 129 clientSession, 'stateChanged', this.onClientStateChange_.bind(this)),
131 new base.RepeatingTimer(this.updateStatistics_.bind(this), 1000) 130 new base.RepeatingTimer(this.updateStatistics_.bind(this), 1000)
132 ); 131 );
133 remoting.clipboard.startSession(); 132 remoting.clipboard.startSession();
134 133
135 this.delegate_.handleConnected(clientSession); 134 this.delegate_.handleConnected(clientSession);
136 }; 135 };
137 136
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 default: 241 default:
243 console.error('Unexpected client plugin state: ' + state.current); 242 console.error('Unexpected client plugin state: ' + state.current);
244 // This should only happen if the web-app and client plugin get out of 243 // This should only happen if the web-app and client plugin get out of
245 // sync, so MISSING_PLUGIN is a suitable error. 244 // sync, so MISSING_PLUGIN is a suitable error.
246 this.onError(remoting.Error.MISSING_PLUGIN); 245 this.onError(remoting.Error.MISSING_PLUGIN);
247 break; 246 break;
248 } 247 }
249 248
250 base.dispose(this.sessionConnectedHooks_); 249 base.dispose(this.sessionConnectedHooks_);
251 this.sessionConnectedHooks_= null; 250 this.sessionConnectedHooks_= null;
252 remoting.clientSession.dispose(); 251 remoting.clientSession.dispose();
kelvinp 2015/03/06 02:58:37 Previously, this will actually remove the plugin.
253 remoting.clientSession = null; 252 remoting.clientSession = null;
254 }; 253 };
255 254
256 /** @private */ 255 /** @private */
257 remoting.Application.prototype.updateStatistics_ = function() { 256 remoting.Application.prototype.updateStatistics_ = function() {
258 var perfstats = remoting.clientSession.getPerfStats(); 257 var perfstats = remoting.clientSession.getPerfStats();
259 remoting.stats.update(perfstats); 258 remoting.stats.update(perfstats);
260 remoting.clientSession.logStatistics(perfstats); 259 remoting.clientSession.logStatistics(perfstats);
261 }; 260 };
262 261
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 * Called when an error needs to be displayed to the user. 332 * Called when an error needs to be displayed to the user.
334 * 333 *
335 * @param {remoting.Error} errorTag The error to be localized and displayed. 334 * @param {remoting.Error} errorTag The error to be localized and displayed.
336 * @return {void} Nothing. 335 * @return {void} Nothing.
337 */ 336 */
338 remoting.Application.Delegate.prototype.handleError = function(errorTag) {}; 337 remoting.Application.Delegate.prototype.handleError = function(errorTag) {};
339 338
340 339
341 /** @type {remoting.Application} */ 340 /** @type {remoting.Application} */
342 remoting.app = null; 341 remoting.app = null;
OLDNEW
« no previous file with comments | « no previous file | remoting/webapp/browser_test/mock_session_connector.js » ('j') | remoting/webapp/crd/js/client_session.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698