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 /** | 5 /** |
6 * @fileoverview | 6 * @fileoverview |
7 * This class implements the functionality that is specific to desktop | 7 * This class implements the functionality that is specific to desktop |
8 * remoting ("Chromoting" or CRD). | 8 * remoting ("Chromoting" or CRD). |
9 */ | 9 */ |
10 | 10 |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 /** | 299 /** |
300 * Called when an error needs to be displayed to the user. | 300 * Called when an error needs to be displayed to the user. |
301 * | 301 * |
302 * @param {remoting.Error} errorTag The error to be localized and displayed. | 302 * @param {remoting.Error} errorTag The error to be localized and displayed. |
303 * @return {void} Nothing. | 303 * @return {void} Nothing. |
304 */ | 304 */ |
305 remoting.DesktopRemoting.prototype.handleError = function(errorTag) { | 305 remoting.DesktopRemoting.prototype.handleError = function(errorTag) { |
306 console.error('Connection failed: ' + errorTag); | 306 console.error('Connection failed: ' + errorTag); |
307 remoting.accessCode = ''; | 307 remoting.accessCode = ''; |
308 | 308 |
| 309 if (errorTag === remoting.Error.AUTHENTICATION_FAILED) { |
| 310 remoting.setMode(remoting.AppMode.HOME); |
| 311 remoting.handleAuthFailureAndRelaunch(); |
| 312 return; |
| 313 } |
| 314 |
309 // Reset the refresh flag so that the next connection will retry if needed. | 315 // Reset the refresh flag so that the next connection will retry if needed. |
310 this.refreshHostJidIfOffline_ = true; | 316 this.refreshHostJidIfOffline_ = true; |
311 | 317 |
312 var errorDiv = document.getElementById('connect-error-message'); | 318 var errorDiv = document.getElementById('connect-error-message'); |
313 l10n.localizeElementFromTag(errorDiv, /** @type {string} */ (errorTag)); | 319 l10n.localizeElementFromTag(errorDiv, /** @type {string} */ (errorTag)); |
314 | 320 |
315 var mode = remoting.clientSession ? remoting.clientSession.getMode() | 321 var mode = remoting.clientSession ? remoting.clientSession.getMode() |
316 : this.app_.getSessionConnector().getConnectionMode(); | 322 : this.app_.getSessionConnector().getConnectionMode(); |
317 if (mode == remoting.ClientSession.Mode.IT2ME) { | 323 if (mode == remoting.ClientSession.Mode.IT2ME) { |
318 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME); | 324 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME); |
319 remoting.hangoutSessionEvents.raiseEvent( | 325 remoting.hangoutSessionEvents.raiseEvent( |
320 remoting.hangoutSessionEvents.sessionStateChanged, | 326 remoting.hangoutSessionEvents.sessionStateChanged, |
321 remoting.ClientSession.State.FAILED | 327 remoting.ClientSession.State.FAILED |
322 ); | 328 ); |
323 } else { | 329 } else { |
324 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_ME2ME); | 330 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_ME2ME); |
325 } | 331 } |
326 }; | 332 }; |
OLD | NEW |