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