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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 if (success) { | 259 if (success) { |
260 var host = remoting.hostList.getHostForId(connector.getHostId()); | 260 var host = remoting.hostList.getHostForId(connector.getHostId()); |
261 if (host) { | 261 if (host) { |
262 connector.retryConnectMe2Me(host); | 262 connector.retryConnectMe2Me(host); |
263 return; | 263 return; |
264 } | 264 } |
265 } | 265 } |
266 that.handleError(error); | 266 that.handleError(error); |
267 }; | 267 }; |
268 | 268 |
269 if (error.tag == remoting.Error.Tag.HOST_IS_OFFLINE && | 269 if (error.hasTag(remoting.Error.Tag.HOST_IS_OFFLINE) && |
270 that.refreshHostJidIfOffline_) { | 270 that.refreshHostJidIfOffline_) { |
271 that.refreshHostJidIfOffline_ = false; | 271 that.refreshHostJidIfOffline_ = false; |
272 // The plugin will be re-created when the host finished refreshing | 272 // The plugin will be re-created when the host finished refreshing |
273 remoting.hostList.refresh(onHostListRefresh); | 273 remoting.hostList.refresh(onHostListRefresh); |
274 } else { | 274 } else { |
275 this.handleError(error); | 275 this.handleError(error); |
276 } | 276 } |
277 }; | 277 }; |
278 | 278 |
279 /** | 279 /** |
(...skipping 18 matching lines...) Expand all Loading... |
298 /** | 298 /** |
299 * Called when an error needs to be displayed to the user. | 299 * Called when an error needs to be displayed to the user. |
300 * | 300 * |
301 * @param {!remoting.Error} error The error to be localized and displayed. | 301 * @param {!remoting.Error} error The error to be localized and displayed. |
302 * @return {void} Nothing. | 302 * @return {void} Nothing. |
303 */ | 303 */ |
304 remoting.DesktopRemoting.prototype.handleError = function(error) { | 304 remoting.DesktopRemoting.prototype.handleError = function(error) { |
305 console.error('Connection failed:', error.tag); | 305 console.error('Connection failed:', error.tag); |
306 remoting.accessCode = ''; | 306 remoting.accessCode = ''; |
307 | 307 |
308 if (error.tag === remoting.Error.Tag.AUTHENTICATION_FAILED) { | 308 if (error.hasTag(remoting.Error.Tag.AUTHENTICATION_FAILED)) { |
309 remoting.setMode(remoting.AppMode.HOME); | 309 remoting.setMode(remoting.AppMode.HOME); |
310 remoting.handleAuthFailureAndRelaunch(); | 310 remoting.handleAuthFailureAndRelaunch(); |
311 return; | 311 return; |
312 } | 312 } |
313 | 313 |
314 // Reset the refresh flag so that the next connection will retry if needed. | 314 // Reset the refresh flag so that the next connection will retry if needed. |
315 this.refreshHostJidIfOffline_ = true; | 315 this.refreshHostJidIfOffline_ = true; |
316 | 316 |
317 var errorDiv = document.getElementById('connect-error-message'); | 317 var errorDiv = document.getElementById('connect-error-message'); |
318 l10n.localizeElementFromTag(errorDiv, error.tag); | 318 l10n.localizeElementFromTag(errorDiv, error.tag); |
319 | 319 |
320 var mode = remoting.clientSession ? remoting.desktopConnectedView.getMode() | 320 var mode = remoting.clientSession ? remoting.desktopConnectedView.getMode() |
321 : this.app_.getSessionConnector().getConnectionMode(); | 321 : this.app_.getSessionConnector().getConnectionMode(); |
322 if (mode == remoting.DesktopConnectedView.Mode.IT2ME) { | 322 if (mode == remoting.DesktopConnectedView.Mode.IT2ME) { |
323 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME); | 323 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME); |
324 } else { | 324 } else { |
325 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_ME2ME); | 325 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_ME2ME); |
326 } | 326 } |
327 }; | 327 }; |
328 | 328 |
329 /** | 329 /** |
330 * No cleanup required for desktop remoting. | 330 * No cleanup required for desktop remoting. |
331 */ | 331 */ |
332 remoting.DesktopRemoting.prototype.handleExit = function() { | 332 remoting.DesktopRemoting.prototype.handleExit = function() { |
333 }; | 333 }; |
OLD | NEW |