OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 /** @suppress {duplicate} */ | 5 /** @suppress {duplicate} */ |
6 var remoting = remoting || {}; | 6 var remoting = remoting || {}; |
7 | 7 |
8 (function() { | 8 (function() { |
9 'use strict'; | 9 'use strict'; |
10 | 10 |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 remoting.setMode(remoting.AppMode.CLIENT_SESSION_FINISHED); | 478 remoting.setMode(remoting.AppMode.CLIENT_SESSION_FINISHED); |
479 } else { | 479 } else { |
480 // The transition from CONNECTING to CLOSED state may happen | 480 // The transition from CONNECTING to CLOSED state may happen |
481 // only with older client plugins. Current version should go the | 481 // only with older client plugins. Current version should go the |
482 // FAILED state when connection fails. | 482 // FAILED state when connection fails. |
483 showConnectError_(remoting.ClientError.INVALID_ACCESS_CODE); | 483 showConnectError_(remoting.ClientError.INVALID_ACCESS_CODE); |
484 } | 484 } |
485 } else if (state == remoting.ClientSession.State.CONNECTION_FAILED) { | 485 } else if (state == remoting.ClientSession.State.CONNECTION_FAILED) { |
486 remoting.debug.log('Client plugin reported connection failed'); | 486 remoting.debug.log('Client plugin reported connection failed'); |
487 if (remoting.session.error == | 487 if (remoting.session.error == |
488 remoting.ClientSession.Error.HOST_IS_OFFLINE) { | 488 remoting.ClientSession.ConnectionError.HOST_IS_OFFLINE) { |
489 showConnectError_(remoting.ClientError.HOST_IS_OFFLINE); | 489 showConnectError_(remoting.ClientError.HOST_IS_OFFLINE); |
490 } else if (remoting.session.error == | 490 } else if (remoting.session.error == |
491 remoting.ClientSession.Error.SESSION_REJECTED) { | 491 remoting.ClientSession.ConnectionError.SESSION_REJECTED) { |
492 showConnectError_(remoting.ClientError.INVALID_ACCESS_CODE); | 492 showConnectError_(remoting.ClientError.INVALID_ACCESS_CODE); |
493 } else if (remoting.session.error == | 493 } else if (remoting.session.error == |
494 remoting.ClientSession.Error.INCOMPATIBLE_PROTOCOL) { | 494 remoting.ClientSession.ConnectionError.INCOMPATIBLE_PROTOCOL) { |
495 showConnectError_(remoting.ClientError.INCOMPATIBLE_PROTOCOL); | 495 showConnectError_(remoting.ClientError.INCOMPATIBLE_PROTOCOL); |
496 } else if (remoting.session.error == | 496 } else if (remoting.session.error == |
497 remoting.ClientSession.Error.NETWORK_FAILURE) { | 497 remoting.ClientSession.ConnectionError.NETWORK_FAILURE) { |
498 showConnectError_(remoting.ClientError.OTHER_ERROR); | 498 showConnectError_(remoting.ClientError.OTHER_ERROR); |
499 } else { | 499 } else { |
500 showConnectError_(remoting.ClientError.OTHER_ERROR); | 500 showConnectError_(remoting.ClientError.OTHER_ERROR); |
501 } | 501 } |
502 } else { | 502 } else { |
503 remoting.debug.log('Unexpected client plugin state: ' + state); | 503 remoting.debug.log('Unexpected client plugin state: ' + state); |
504 // This should only happen if the web-app and client plugin get out of | 504 // This should only happen if the web-app and client plugin get out of |
505 // sync, and even then the version check should allow compatibility. | 505 // sync, and even then the version check should allow compatibility. |
506 showConnectError_(remoting.ClientError.MISSING_PLUGIN); | 506 showConnectError_(remoting.ClientError.MISSING_PLUGIN); |
507 } | 507 } |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 } | 743 } |
744 | 744 |
745 function recenterToolbar_() { | 745 function recenterToolbar_() { |
746 var toolbar = document.getElementById('session-toolbar'); | 746 var toolbar = document.getElementById('session-toolbar'); |
747 var toolbarX = (window.innerWidth - toolbar.clientWidth) / 2; | 747 var toolbarX = (window.innerWidth - toolbar.clientWidth) / 2; |
748 toolbar.style['left'] = toolbarX + 'px'; | 748 toolbar.style['left'] = toolbarX + 'px'; |
749 remoting.debug.log('toolbar moved to ' + toolbarX); | 749 remoting.debug.log('toolbar moved to ' + toolbarX); |
750 } | 750 } |
751 | 751 |
752 }()); | 752 }()); |
OLD | NEW |