| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 remoting.ClientSession.ConnectionError = { | 175 remoting.ClientSession.ConnectionError = { |
| 176 UNKNOWN: -1, | 176 UNKNOWN: -1, |
| 177 NONE: 0, | 177 NONE: 0, |
| 178 HOST_IS_OFFLINE: 1, | 178 HOST_IS_OFFLINE: 1, |
| 179 SESSION_REJECTED: 2, | 179 SESSION_REJECTED: 2, |
| 180 INCOMPATIBLE_PROTOCOL: 3, | 180 INCOMPATIBLE_PROTOCOL: 3, |
| 181 NETWORK_FAILURE: 4, | 181 NETWORK_FAILURE: 4, |
| 182 HOST_OVERLOAD: 5, | 182 HOST_OVERLOAD: 5, |
| 183 MAX_SESSION_LENGTH: 6, | 183 MAX_SESSION_LENGTH: 6, |
| 184 HOST_CONFIGURATION_ERROR: 7, | 184 HOST_CONFIGURATION_ERROR: 7, |
| 185 NACL_PLUGIN_CRASHED: 8 | 185 NACL_PLUGIN_CRASHED: 8, |
| 186 INVALID_ACCOUNT: 9 |
| 186 }; | 187 }; |
| 187 | 188 |
| 188 /** | 189 /** |
| 189 * @param {string} error The connection error name. | 190 * @param {string} error The connection error name. |
| 190 * @return {remoting.ClientSession.ConnectionError} The connection error enum. | 191 * @return {remoting.ClientSession.ConnectionError} The connection error enum. |
| 191 */ | 192 */ |
| 192 remoting.ClientSession.ConnectionError.fromString = function(error) { | 193 remoting.ClientSession.ConnectionError.fromString = function(error) { |
| 193 if (!remoting.ClientSession.ConnectionError.hasOwnProperty(error)) { | 194 if (!remoting.ClientSession.ConnectionError.hasOwnProperty(error)) { |
| 194 console.error('Unexpected ClientSession.ConnectionError string: ', error); | 195 console.error('Unexpected ClientSession.ConnectionError string: ', error); |
| 195 return remoting.ClientSession.ConnectionError.UNKNOWN; | 196 return remoting.ClientSession.ConnectionError.UNKNOWN; |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 break; | 482 break; |
| 482 case remoting.ClientSession.ConnectionError.MAX_SESSION_LENGTH: | 483 case remoting.ClientSession.ConnectionError.MAX_SESSION_LENGTH: |
| 483 errorTag = remoting.Error.Tag.MAX_SESSION_LENGTH; | 484 errorTag = remoting.Error.Tag.MAX_SESSION_LENGTH; |
| 484 break; | 485 break; |
| 485 case remoting.ClientSession.ConnectionError.HOST_CONFIGURATION_ERROR: | 486 case remoting.ClientSession.ConnectionError.HOST_CONFIGURATION_ERROR: |
| 486 errorTag = remoting.Error.Tag.HOST_CONFIGURATION_ERROR; | 487 errorTag = remoting.Error.Tag.HOST_CONFIGURATION_ERROR; |
| 487 break; | 488 break; |
| 488 case remoting.ClientSession.ConnectionError.NACL_PLUGIN_CRASHED: | 489 case remoting.ClientSession.ConnectionError.NACL_PLUGIN_CRASHED: |
| 489 errorTag = remoting.Error.Tag.NACL_PLUGIN_CRASHED; | 490 errorTag = remoting.Error.Tag.NACL_PLUGIN_CRASHED; |
| 490 break; | 491 break; |
| 492 case remoting.ClientSession.ConnectionError.INVALID_ACCOUNT: |
| 493 errorTag = remoting.Error.Tag.INVALID_ACCOUNT; |
| 494 break; |
| 491 default: | 495 default: |
| 492 this.error_ = remoting.Error.unexpected(); | 496 this.error_ = remoting.Error.unexpected(); |
| 493 } | 497 } |
| 494 this.error_ = new remoting.Error( | 498 this.error_ = new remoting.Error( |
| 495 errorTag, this.xmppErrorCache_.getFirstErrorStanza()); | 499 errorTag, this.xmppErrorCache_.getFirstErrorStanza()); |
| 496 } | 500 } |
| 497 this.setState_(status); | 501 this.setState_(status); |
| 498 }; | 502 }; |
| 499 | 503 |
| 500 /** | 504 /** |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 } else if (previous == State.CONNECTED && current == State.FAILED) { | 717 } else if (previous == State.CONNECTED && current == State.FAILED) { |
| 714 return State.CONNECTION_DROPPED; | 718 return State.CONNECTION_DROPPED; |
| 715 } | 719 } |
| 716 return current; | 720 return current; |
| 717 }; | 721 }; |
| 718 | 722 |
| 719 /** @private */ | 723 /** @private */ |
| 720 remoting.ClientSession.prototype.reportStatistics = function() { | 724 remoting.ClientSession.prototype.reportStatistics = function() { |
| 721 this.logger_.logStatistics(this.plugin_.getPerfStats()); | 725 this.logger_.logStatistics(this.plugin_.getPerfStats()); |
| 722 }; | 726 }; |
| OLD | NEW |