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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 if (success) { | 270 if (success) { |
271 var host = remoting.hostList.getHostForId(connector.getHostId()); | 271 var host = remoting.hostList.getHostForId(connector.getHostId()); |
272 if (host) { | 272 if (host) { |
273 connector.retryConnectMe2Me(host); | 273 connector.retryConnectMe2Me(host); |
274 return; | 274 return; |
275 } | 275 } |
276 } | 276 } |
277 that.handleError(error); | 277 that.handleError(error); |
278 }; | 278 }; |
279 | 279 |
280 if (error.tag == remoting.Error.Tag.HOST_IS_OFFLINE && | 280 if (error.hasTag(remoting.Error.Tag.HOST_IS_OFFLINE) && |
281 that.refreshHostJidIfOffline_) { | 281 that.refreshHostJidIfOffline_) { |
282 that.refreshHostJidIfOffline_ = false; | 282 that.refreshHostJidIfOffline_ = false; |
283 // The plugin will be re-created when the host finished refreshing | 283 // The plugin will be re-created when the host finished refreshing |
284 remoting.hostList.refresh(onHostListRefresh); | 284 remoting.hostList.refresh(onHostListRefresh); |
285 } else { | 285 } else { |
286 this.handleError(error); | 286 this.handleError(error); |
287 } | 287 } |
288 }; | 288 }; |
289 | 289 |
290 /** | 290 /** |
(...skipping 15 matching lines...) Expand all Loading... |
306 return false; | 306 return false; |
307 }; | 307 }; |
308 | 308 |
309 /** | 309 /** |
310 * Called when an error needs to be displayed to the user. | 310 * Called when an error needs to be displayed to the user. |
311 * | 311 * |
312 * @param {!remoting.Error} error The error to be localized and displayed. | 312 * @param {!remoting.Error} error The error to be localized and displayed. |
313 * @return {void} Nothing. | 313 * @return {void} Nothing. |
314 */ | 314 */ |
315 remoting.DesktopRemoting.prototype.handleError = function(error) { | 315 remoting.DesktopRemoting.prototype.handleError = function(error) { |
316 console.error('Connection failed:' + error.tag); | 316 console.error('Connection failed: ' + error.toString()); |
317 remoting.accessCode = ''; | 317 remoting.accessCode = ''; |
318 | 318 |
319 if (error.tag === remoting.Error.Tag.AUTHENTICATION_FAILED) { | 319 if (error.hasTag(remoting.Error.Tag.AUTHENTICATION_FAILED)) { |
320 remoting.setMode(remoting.AppMode.HOME); | 320 remoting.setMode(remoting.AppMode.HOME); |
321 remoting.handleAuthFailureAndRelaunch(); | 321 remoting.handleAuthFailureAndRelaunch(); |
322 return; | 322 return; |
323 } | 323 } |
324 | 324 |
325 // Reset the refresh flag so that the next connection will retry if needed. | 325 // Reset the refresh flag so that the next connection will retry if needed. |
326 this.refreshHostJidIfOffline_ = true; | 326 this.refreshHostJidIfOffline_ = true; |
327 | 327 |
328 var errorDiv = document.getElementById('connect-error-message'); | 328 var errorDiv = document.getElementById('connect-error-message'); |
329 l10n.localizeElementFromTag(errorDiv, error.tag); | 329 l10n.localizeElementFromTag(errorDiv, error.getTag()); |
330 | 330 |
331 var mode = remoting.clientSession ? remoting.desktopConnectedView.getMode() | 331 var mode = remoting.clientSession ? remoting.desktopConnectedView.getMode() |
332 : this.app_.getSessionConnector().getConnectionMode(); | 332 : this.app_.getSessionConnector().getConnectionMode(); |
333 if (mode == remoting.DesktopConnectedView.Mode.IT2ME) { | 333 if (mode == remoting.DesktopConnectedView.Mode.IT2ME) { |
334 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME); | 334 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME); |
335 } else { | 335 } else { |
336 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_ME2ME); | 336 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_ME2ME); |
337 } | 337 } |
338 }; | 338 }; |
339 | 339 |
340 /** | 340 /** |
341 * No cleanup required for desktop remoting. | 341 * No cleanup required for desktop remoting. |
342 */ | 342 */ |
343 remoting.DesktopRemoting.prototype.handleExit = function() { | 343 remoting.DesktopRemoting.prototype.handleExit = function() { |
344 }; | 344 }; |
OLD | NEW |