OLD | NEW |
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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 /** | 278 /** |
279 * Disconnect the current session with a particular |error|. The session will | 279 * Disconnect the current session with a particular |error|. The session will |
280 * raise a |stateChanged| event in response to it. The caller should then call | 280 * raise a |stateChanged| event in response to it. The caller should then call |
281 * dispose() to remove and destroy the <embed> element. | 281 * dispose() to remove and destroy the <embed> element. |
282 * | 282 * |
283 * @param {!remoting.Error} error The reason for the disconnection. Use | 283 * @param {!remoting.Error} error The reason for the disconnection. Use |
284 * remoting.Error.none() if there is no error. | 284 * remoting.Error.none() if there is no error. |
285 * @return {void} Nothing. | 285 * @return {void} Nothing. |
286 */ | 286 */ |
287 remoting.ClientSession.prototype.disconnect = function(error) { | 287 remoting.ClientSession.prototype.disconnect = function(error) { |
| 288 if (this.isFinished()) { |
| 289 return; |
| 290 } |
| 291 |
288 this.sendIq_( | 292 this.sendIq_( |
289 '<cli:iq ' + | 293 '<cli:iq ' + |
290 'to="' + this.host_.jabberId + '" ' + | 294 'to="' + this.host_.jabberId + '" ' + |
291 'type="set" ' + | 295 'type="set" ' + |
292 'id="session-terminate" ' + | 296 'id="session-terminate" ' + |
293 'xmlns:cli="jabber:client">' + | 297 'xmlns:cli="jabber:client">' + |
294 '<jingle ' + | 298 '<jingle ' + |
295 'xmlns="urn:xmpp:jingle:1" ' + | 299 'xmlns="urn:xmpp:jingle:1" ' + |
296 'action="session-terminate" ' + | 300 'action="session-terminate" ' + |
297 'sid="' + this.sessionId_ + '">' + | 301 'sid="' + this.sessionId_ + '">' + |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 * For example, if attempting a connection using a cached JID, host-offline | 621 * For example, if attempting a connection using a cached JID, host-offline |
618 * errors should not be logged because the JID will be refreshed and the | 622 * errors should not be logged because the JID will be refreshed and the |
619 * connection retried. | 623 * connection retried. |
620 * | 624 * |
621 * @param {boolean} enable True to log host-offline errors; false to suppress. | 625 * @param {boolean} enable True to log host-offline errors; false to suppress. |
622 */ | 626 */ |
623 remoting.ClientSession.prototype.logHostOfflineErrors = function(enable) { | 627 remoting.ClientSession.prototype.logHostOfflineErrors = function(enable) { |
624 this.logHostOfflineErrors_ = enable; | 628 this.logHostOfflineErrors_ = enable; |
625 }; | 629 }; |
626 | 630 |
OLD | NEW |