| 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 /** |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 chrome.socket.create("tcp", {}, this.onSocketCreated_.bind(this)); | 150 chrome.socket.create("tcp", {}, this.onSocketCreated_.bind(this)); |
| 151 this.setState_(remoting.SignalStrategy.State.CONNECTING); | 151 this.setState_(remoting.SignalStrategy.State.CONNECTING); |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 /** @param {string} message */ | 154 /** @param {string} message */ |
| 155 remoting.XmppConnection.prototype.sendMessage = function(message) { | 155 remoting.XmppConnection.prototype.sendMessage = function(message) { |
| 156 base.debug.assert(this.state_ == remoting.SignalStrategy.State.CONNECTED); | 156 base.debug.assert(this.state_ == remoting.SignalStrategy.State.CONNECTED); |
| 157 this.sendString_(message); | 157 this.sendString_(message); |
| 158 }; | 158 }; |
| 159 | 159 |
| 160 /** |
| 161 * @param {remoting.LogToServer} logToServer The LogToServer instance for the |
| 162 * connection. |
| 163 */ |
| 164 remoting.XmppConnection.prototype.sendConnectionSetupResults = |
| 165 function(logToServer) { |
| 166 }; |
| 167 |
| 160 /** @return {remoting.SignalStrategy.State} Current state */ | 168 /** @return {remoting.SignalStrategy.State} Current state */ |
| 161 remoting.XmppConnection.prototype.getState = function() { | 169 remoting.XmppConnection.prototype.getState = function() { |
| 162 return this.state_; | 170 return this.state_; |
| 163 }; | 171 }; |
| 164 | 172 |
| 165 /** @return {remoting.Error} Error when in FAILED state. */ | 173 /** @return {remoting.Error} Error when in FAILED state. */ |
| 166 remoting.XmppConnection.prototype.getError = function() { | 174 remoting.XmppConnection.prototype.getError = function() { |
| 167 return this.error_; | 175 return this.error_; |
| 168 }; | 176 }; |
| 169 | 177 |
| 170 /** @return {string} Current JID when in CONNECTED state. */ | 178 /** @return {string} Current JID when in CONNECTED state. */ |
| 171 remoting.XmppConnection.prototype.getJid = function() { | 179 remoting.XmppConnection.prototype.getJid = function() { |
| 172 return this.jid_; | 180 return this.jid_; |
| 173 }; | 181 }; |
| 174 | 182 |
| 183 /** @return {remoting.SignalStrategy.Type} The signal strategy type. */ |
| 184 remoting.XmppConnection.prototype.getType = function() { |
| 185 return remoting.SignalStrategy.Type.XMPP; |
| 186 }; |
| 187 |
| 175 remoting.XmppConnection.prototype.dispose = function() { | 188 remoting.XmppConnection.prototype.dispose = function() { |
| 176 this.closeSocket_(); | 189 this.closeSocket_(); |
| 177 this.setState_(remoting.SignalStrategy.State.CLOSED); | 190 this.setState_(remoting.SignalStrategy.State.CLOSED); |
| 178 }; | 191 }; |
| 179 | 192 |
| 180 /** | 193 /** |
| 181 * @param {chrome.socket.CreateInfo} createInfo | 194 * @param {chrome.socket.CreateInfo} createInfo |
| 182 * @private | 195 * @private |
| 183 */ | 196 */ |
| 184 remoting.XmppConnection.prototype.onSocketCreated_ = function(createInfo) { | 197 remoting.XmppConnection.prototype.onSocketCreated_ = function(createInfo) { |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 /** | 480 /** |
| 468 * @param {remoting.SignalStrategy.State} newState | 481 * @param {remoting.SignalStrategy.State} newState |
| 469 * @private | 482 * @private |
| 470 */ | 483 */ |
| 471 remoting.XmppConnection.prototype.setState_ = function(newState) { | 484 remoting.XmppConnection.prototype.setState_ = function(newState) { |
| 472 if (this.state_ != newState) { | 485 if (this.state_ != newState) { |
| 473 this.state_ = newState; | 486 this.state_ = newState; |
| 474 this.onStateChangedCallback_(this.state_); | 487 this.onStateChangedCallback_(this.state_); |
| 475 } | 488 } |
| 476 }; | 489 }; |
| OLD | NEW |