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

Side by Side Diff: remoting/webapp/crd/js/client_session.js

Issue 952353002: Requiem for client_screen.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reviewer's feedback 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 * Class handling creation and teardown of a remoting client session. 7 * Class handling creation and teardown of a remoting client session.
8 * 8 *
9 * The ClientSession class controls lifetime of the client plugin 9 * The ClientSession class controls lifetime of the client plugin
10 * object and provides the plugin with the functionality it needs to 10 * object and provides the plugin with the functionality it needs to
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 * authentication methods the client should attempt to use. 47 * authentication methods the client should attempt to use.
48 * @param {remoting.DesktopConnectedView.Mode} mode The mode of this connection. 48 * @param {remoting.DesktopConnectedView.Mode} mode The mode of this connection.
49 * @param {string} clientPairingId For paired Me2Me connections, the 49 * @param {string} clientPairingId For paired Me2Me connections, the
50 * pairing id for this client, as issued by the host. 50 * pairing id for this client, as issued by the host.
51 * @param {string} clientPairedSecret For paired Me2Me connections, the 51 * @param {string} clientPairedSecret For paired Me2Me connections, the
52 * paired secret for this client, as issued by the host. 52 * paired secret for this client, as issued by the host.
53 * @param {string} defaultRemapKeys The default set of remap keys, to use 53 * @param {string} defaultRemapKeys The default set of remap keys, to use
54 * when the client doesn't define any. 54 * when the client doesn't define any.
55 * @constructor 55 * @constructor
56 * @extends {base.EventSourceImpl} 56 * @extends {base.EventSourceImpl}
57 * @implements {base.Disposable}
57 */ 58 */
58 remoting.ClientSession = function(host, signalStrategy, container, accessCode, 59 remoting.ClientSession = function(host, signalStrategy, container, accessCode,
59 fetchPin, fetchThirdPartyToken, 60 fetchPin, fetchThirdPartyToken,
60 authenticationMethods, mode, clientPairingId, 61 authenticationMethods, mode, clientPairingId,
61 clientPairedSecret, defaultRemapKeys) { 62 clientPairedSecret, defaultRemapKeys) {
62 /** @private */ 63 /** @private */
63 this.state_ = remoting.ClientSession.State.CREATED; 64 this.state_ = remoting.ClientSession.State.CREATED;
64 65
65 /** @private */ 66 /** @private */
66 this.error_ = remoting.Error.NONE; 67 this.error_ = remoting.Error.NONE;
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 }; 315 };
315 316
316 /** 317 /**
317 * @param {remoting.Error} error 318 * @param {remoting.Error} error
318 */ 319 */
319 remoting.ClientSession.prototype.resetWithError_ = function(error) { 320 remoting.ClientSession.prototype.resetWithError_ = function(error) {
320 this.signalStrategy_.setIncomingStanzaCallback(null); 321 this.signalStrategy_.setIncomingStanzaCallback(null);
321 this.removePlugin(); 322 this.removePlugin();
322 this.error_ = error; 323 this.error_ = error;
323 this.setState_(remoting.ClientSession.State.FAILED); 324 this.setState_(remoting.ClientSession.State.FAILED);
324 } 325 };
325 326
326 /** 327 /**
327 * Deletes the <embed> element from the container, without sending a 328 * Deletes the <embed> element from the container, without sending a
328 * session_terminate request. This is to be called when the session was 329 * session_terminate request. This is to be called when the session was
329 * disconnected by the Host. 330 * disconnected by the Host.
330 * 331 *
331 * @return {void} Nothing. 332 * @return {void} Nothing.
332 */ 333 */
333 remoting.ClientSession.prototype.removePlugin = function() { 334 remoting.ClientSession.prototype.removePlugin = function() {
334 this.uiHandler_.removePlugin(); 335 this.uiHandler_.removePlugin();
335 this.plugin_ = null; 336 this.plugin_ = null;
337 remoting.desktopConnectedView = null;
336 }; 338 };
337 339
338 /** 340 /**
339 * Disconnect the current session with a particular |error|. The session will 341 * Disconnect the current session with a particular |error|. The session will
340 * raise a |stateChanged| event in response to it. The caller should then call 342 * raise a |stateChanged| event in response to it. The caller should then call
341 * |cleanup| to remove and destroy the <embed> element. 343 * dispose() to remove and destroy the <embed> element.
342 * 344 *
343 * @param {remoting.Error} error The reason for the disconnection. Use 345 * @param {remoting.Error} error The reason for the disconnection. Use
344 * remoting.Error.NONE if there is no error. 346 * remoting.Error.NONE if there is no error.
345 * @return {void} Nothing. 347 * @return {void} Nothing.
346 */ 348 */
347 remoting.ClientSession.prototype.disconnect = function(error) { 349 remoting.ClientSession.prototype.disconnect = function(error) {
348 var state = (error == remoting.Error.NONE) ? 350 var state = (error == remoting.Error.NONE) ?
349 remoting.ClientSession.State.CLOSED : 351 remoting.ClientSession.State.CLOSED :
350 remoting.ClientSession.State.FAILED; 352 remoting.ClientSession.State.FAILED;
351 353
352 // The plugin won't send a state change notification, so we explicitly log 354 // The plugin won't send a state change notification, so we explicitly log
353 // the fact that the connection has closed. 355 // the fact that the connection has closed.
354 this.logToServer.logClientSessionStateChange(state, error); 356 this.logToServer.logClientSessionStateChange(state, error);
355 this.error_ = error; 357 this.error_ = error;
356 this.setState_(state); 358 this.setState_(state);
357 }; 359 };
358 360
359 /** 361 /**
360 * Deletes the <embed> element from the container and disconnects. 362 * Deletes the <embed> element from the container and disconnects.
361 * 363 *
362 * @return {void} Nothing. 364 * @return {void} Nothing.
363 */ 365 */
364 remoting.ClientSession.prototype.cleanup = function() { 366 remoting.ClientSession.prototype.dispose = function() {
365 this.sendIq_( 367 this.sendIq_(
366 '<cli:iq ' + 368 '<cli:iq ' +
367 'to="' + this.host_.jabberId + '" ' + 369 'to="' + this.host_.jabberId + '" ' +
368 'type="set" ' + 370 'type="set" ' +
369 'id="session-terminate" ' + 371 'id="session-terminate" ' +
370 'xmlns:cli="jabber:client">' + 372 'xmlns:cli="jabber:client">' +
371 '<jingle ' + 373 '<jingle ' +
372 'xmlns="urn:xmpp:jingle:1" ' + 374 'xmlns="urn:xmpp:jingle:1" ' +
373 'action="session-terminate" ' + 375 'action="session-terminate" ' +
374 'sid="' + this.sessionId_ + '">' + 376 'sid="' + this.sessionId_ + '">' +
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 * @param {boolean} enable True to enable rendering. 844 * @param {boolean} enable True to enable rendering.
843 */ 845 */
844 remoting.ClientSession.prototype.enableDebugRegion = function(enable) { 846 remoting.ClientSession.prototype.enableDebugRegion = function(enable) {
845 if (enable) { 847 if (enable) {
846 this.plugin_.setDebugDirtyRegionHandler( 848 this.plugin_.setDebugDirtyRegionHandler(
847 this.uiHandler_.handleDebugRegion.bind(this.uiHandler_)); 849 this.uiHandler_.handleDebugRegion.bind(this.uiHandler_));
848 } else { 850 } else {
849 this.plugin_.setDebugDirtyRegionHandler(null); 851 this.plugin_.setDebugDirtyRegionHandler(null);
850 } 852 }
851 } 853 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698