| 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** @suppress {duplicate} */ | 7 /** @suppress {duplicate} */ |
| 8 var remoting = remoting || {}; | 8 var remoting = remoting || {}; |
| 9 | 9 |
| 10 /** | 10 /** |
| 11 * A connection to an XMPP server. | 11 * A connection to an XMPP server. |
| 12 * | 12 * |
| 13 * TODO(sergeyu): Chrome provides two APIs for TCP sockets: chrome.socket and | 13 * TODO(sergeyu): Chrome provides two APIs for TCP sockets: chrome.socket and |
| 14 * chrome.sockets.tcp . chrome.socket is deprecated but it's still used here | 14 * chrome.sockets.tcp . chrome.socket is deprecated but it's still used here |
| 15 * because TLS support in chrome.sockets.tcp is currently broken, see | 15 * because TLS support in chrome.sockets.tcp is currently broken, see |
| 16 * crbug.com/403076 . | 16 * crbug.com/403076 . |
| 17 * | 17 * |
| 18 * @constructor | 18 * @constructor |
| 19 * @implements {remoting.SignalStrategy} | 19 * @implements {remoting.SignalStrategy} |
| 20 */ | 20 */ |
| 21 remoting.XmppConnection = function() { | 21 remoting.XmppConnection = function() { |
| 22 /** @private */ | 22 /** @private */ |
| 23 this.server_ = ''; | 23 this.server_ = ''; |
| 24 /** @private */ | 24 /** @private */ |
| 25 this.port_ = 0; | 25 this.port_ = 0; |
| 26 /** @type {?function(remoting.SignalStrategy.State):void} @private */ | 26 /** @private {?function(remoting.SignalStrategy.State):void} */ |
| 27 this.onStateChangedCallback_ = null; | 27 this.onStateChangedCallback_ = null; |
| 28 /** @type {?function(Element):void} @private */ | 28 /** @private {?function(Element):void} */ |
| 29 this.onIncomingStanzaCallback_ = null; | 29 this.onIncomingStanzaCallback_ = null; |
| 30 /** @private */ | 30 /** @private */ |
| 31 this.socketId_ = -1; | 31 this.socketId_ = -1; |
| 32 /** @private */ | 32 /** @private */ |
| 33 this.state_ = remoting.SignalStrategy.State.NOT_CONNECTED; | 33 this.state_ = remoting.SignalStrategy.State.NOT_CONNECTED; |
| 34 /** @private */ | 34 /** @private */ |
| 35 this.readPending_ = false; | 35 this.readPending_ = false; |
| 36 /** @private */ | 36 /** @private */ |
| 37 this.sendPending_ = false; | 37 this.sendPending_ = false; |
| 38 /** @private */ | 38 /** @private */ |
| 39 this.startTlsPending_ = false; | 39 this.startTlsPending_ = false; |
| 40 /** @type {Array<ArrayBuffer>} @private */ | 40 /** @private {Array<ArrayBuffer>} */ |
| 41 this.sendQueue_ = []; | 41 this.sendQueue_ = []; |
| 42 /** @type {remoting.XmppLoginHandler} @private*/ | 42 /** @private {remoting.XmppLoginHandler} */ |
| 43 this.loginHandler_ = null; | 43 this.loginHandler_ = null; |
| 44 /** @type {remoting.XmppStreamParser} @private*/ | 44 /** @private {remoting.XmppStreamParser} */ |
| 45 this.streamParser_ = null; | 45 this.streamParser_ = null; |
| 46 /** @private */ | 46 /** @private */ |
| 47 this.jid_ = ''; | 47 this.jid_ = ''; |
| 48 /** @private */ | 48 /** @private */ |
| 49 this.error_ = remoting.Error.NONE; | 49 this.error_ = remoting.Error.NONE; |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 /** | 52 /** |
| 53 * @param {function(remoting.SignalStrategy.State):void} onStateChangedCallback | 53 * @param {function(remoting.SignalStrategy.State):void} onStateChangedCallback |
| 54 */ | 54 */ |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 /** | 385 /** |
| 386 * @param {remoting.SignalStrategy.State} newState | 386 * @param {remoting.SignalStrategy.State} newState |
| 387 * @private | 387 * @private |
| 388 */ | 388 */ |
| 389 remoting.XmppConnection.prototype.setState_ = function(newState) { | 389 remoting.XmppConnection.prototype.setState_ = function(newState) { |
| 390 if (this.state_ != newState) { | 390 if (this.state_ != newState) { |
| 391 this.state_ = newState; | 391 this.state_ = newState; |
| 392 this.onStateChangedCallback_(this.state_); | 392 this.onStateChangedCallback_(this.state_); |
| 393 } | 393 } |
| 394 }; | 394 }; |
| OLD | NEW |