OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 * Connect set-up state machine for Me2Me and IT2Me | 7 * Connect set-up state machine for Me2Me and IT2Me |
8 */ | 8 */ |
9 | 9 |
10 'use strict'; | 10 'use strict'; |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 console.error('ERROR: bad plugin version'); | 349 console.error('ERROR: bad plugin version'); |
350 this.pluginError_(remoting.Error.BAD_PLUGIN_VERSION); | 350 this.pluginError_(remoting.Error.BAD_PLUGIN_VERSION); |
351 return; | 351 return; |
352 } | 352 } |
353 | 353 |
354 this.clientSession_ = new remoting.ClientSession( | 354 this.clientSession_ = new remoting.ClientSession( |
355 this.plugin_, this.host_, this.signalStrategy_, this.connectionMode_); | 355 this.plugin_, this.host_, this.signalStrategy_, this.connectionMode_); |
356 remoting.clientSession = this.clientSession_; | 356 remoting.clientSession = this.clientSession_; |
357 | 357 |
358 this.connectedView_ = new remoting.DesktopConnectedView( | 358 this.connectedView_ = new remoting.DesktopConnectedView( |
359 this.plugin_, this.clientSession_, this.clientContainer_, this.host_, | 359 this.plugin_, this.clientContainer_, this.host_, |
360 this.connectionMode_, | 360 this.connectionMode_, this.defaultRemapKeys_); |
361 this.defaultRemapKeys_); | |
362 remoting.desktopConnectedView = this.connectedView_; | 361 remoting.desktopConnectedView = this.connectedView_; |
363 | 362 |
364 this.clientSession_.logHostOfflineErrors(this.logHostOfflineErrors_); | 363 this.clientSession_.logHostOfflineErrors(this.logHostOfflineErrors_); |
365 this.clientSession_.addEventListener( | 364 this.clientSession_.addEventListener( |
366 remoting.ClientSession.Events.stateChanged, | 365 remoting.ClientSession.Events.stateChanged, |
367 this.bound_.onStateChange); | 366 this.bound_.onStateChange); |
368 | 367 |
369 this.plugin_.connect( | 368 this.plugin_.connect( |
370 this.host_, this.signalStrategy_.getJid(), this.credentialsProvider_); | 369 this.host_, this.signalStrategy_.getJid(), this.credentialsProvider_); |
371 }; | 370 }; |
372 | 371 |
373 /** | 372 /** |
374 * @param {!remoting.Error} error | 373 * @param {!remoting.Error} error |
375 * @private | 374 * @private |
376 */ | 375 */ |
377 remoting.SessionConnectorImpl.prototype.pluginError_ = function(error) { | 376 remoting.SessionConnectorImpl.prototype.pluginError_ = function(error) { |
378 this.signalStrategy_.setIncomingStanzaCallback(null); | 377 this.signalStrategy_.setIncomingStanzaCallback(null); |
379 this.clientSession_.disconnect(error); | 378 this.clientSession_.disconnect(error); |
380 this.removePlugin_(); | 379 this.removePlugin_(); |
381 }; | 380 }; |
382 | 381 |
383 /** @private */ | 382 /** @private */ |
384 remoting.SessionConnectorImpl.prototype.removePlugin_ = function() { | 383 remoting.SessionConnectorImpl.prototype.removePlugin_ = function() { |
385 if (this.clientSession_) { | 384 if (this.clientSession_) { |
386 this.clientSession_.removePlugin(); | 385 this.clientSession_.removePlugin(); |
387 } | 386 } |
388 this.clientSession_ = null; | 387 this.clientSession_ = null; |
389 remoting.clientSession = null; | 388 remoting.clientSession = null; |
390 | 389 |
391 if (this.connectedView_) { | 390 base.dispose(this.connectedView_); |
392 this.connectedView_.removePlugin(); | |
393 } | |
394 this.connectedView_ = null; | 391 this.connectedView_ = null; |
395 remoting.desktopConnectedView = null; | 392 remoting.desktopConnectedView = null; |
396 | 393 |
397 if (this.plugin_) { | 394 base.dispose(this.plugin_); |
398 this.plugin_.dispose(); | |
399 } | |
400 this.plugin_ = null; | 395 this.plugin_ = null; |
401 }; | 396 }; |
402 | 397 |
403 /** | 398 /** |
404 * Handle a change in the state of the client session prior to successful | 399 * Handle a change in the state of the client session prior to successful |
405 * connection (after connection, this class no longer handles state change | 400 * connection (after connection, this class no longer handles state change |
406 * events). Errors that occur while connecting either trigger a reconnect | 401 * events). Errors that occur while connecting either trigger a reconnect |
407 * or notify the onError handler. | 402 * or notify the onError handler. |
408 * | 403 * |
409 * @param {remoting.ClientSession.StateEvent=} event | 404 * @param {remoting.ClientSession.StateEvent=} event |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 */ | 491 */ |
497 remoting.DefaultSessionConnectorFactory.prototype.createConnector = | 492 remoting.DefaultSessionConnectorFactory.prototype.createConnector = |
498 function(clientContainer, onConnected, onError, onExtensionMessage, | 493 function(clientContainer, onConnected, onError, onExtensionMessage, |
499 onConnectionFailed, requiredCapabilities, defaultRemapKeys) { | 494 onConnectionFailed, requiredCapabilities, defaultRemapKeys) { |
500 return new remoting.SessionConnectorImpl(clientContainer, onConnected, | 495 return new remoting.SessionConnectorImpl(clientContainer, onConnected, |
501 onError, onExtensionMessage, | 496 onError, onExtensionMessage, |
502 onConnectionFailed, | 497 onConnectionFailed, |
503 requiredCapabilities, | 498 requiredCapabilities, |
504 defaultRemapKeys); | 499 defaultRemapKeys); |
505 }; | 500 }; |
OLD | NEW |