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 var remoting = remoting || {}; | 5 var remoting = remoting || {}; |
6 | 6 |
7 (function() { | 7 (function() { |
8 'use strict'; | 8 'use strict'; |
9 | 9 |
10 window.addEventListener('blur', pluginLostFocus_, false); | 10 window.addEventListener('blur', pluginLostFocus_, false); |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 // TODO(jamiewalch): This is not quite correct, as it will report | 422 // TODO(jamiewalch): This is not quite correct, as it will report |
423 // "Invalid access code", regardless of what actually went wrong. | 423 // "Invalid access code", regardless of what actually went wrong. |
424 // Fix this up by having the host send a suitable error code. | 424 // Fix this up by having the host send a suitable error code. |
425 showConnectError_(remoting.ClientError.INVALID_ACCESS_CODE); | 425 showConnectError_(remoting.ClientError.INVALID_ACCESS_CODE); |
426 } | 426 } |
427 } else if (state == remoting.ClientSession.State.CONNECTION_FAILED) { | 427 } else if (state == remoting.ClientSession.State.CONNECTION_FAILED) { |
428 remoting.debug.log('Client plugin reported connection failed'); | 428 remoting.debug.log('Client plugin reported connection failed'); |
429 showConnectError_(remoting.ClientError.OTHER_ERROR); | 429 showConnectError_(remoting.ClientError.OTHER_ERROR); |
430 } else { | 430 } else { |
431 remoting.debug.log('Unexpected client plugin state: ' + state); | 431 remoting.debug.log('Unexpected client plugin state: ' + state); |
432 showConnectError_(remoting.ClientError.OTHER_ERROR); | 432 // This should only happen if the web-app and client plugin get out of |
| 433 // sync, and even then the version check should allow compatibility. |
| 434 showConnectError_(remoting.ClientError.MISSING_PLUGIN); |
433 } | 435 } |
434 } | 436 } |
435 | 437 |
436 function startSession_() { | 438 function startSession_() { |
437 remoting.debug.log('Starting session...'); | 439 remoting.debug.log('Starting session...'); |
438 remoting.username = getEmail(); | 440 remoting.username = getEmail(); |
439 remoting.session = | 441 remoting.session = |
440 new remoting.ClientSession(remoting.hostJid, remoting.hostPublicKey, | 442 new remoting.ClientSession(remoting.hostJid, remoting.hostPublicKey, |
441 remoting.accessCode, getEmail(), | 443 remoting.accessCode, getEmail(), |
442 onClientStateChange_); | 444 onClientStateChange_); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 return result; | 632 return result; |
631 default: | 633 default: |
632 return NULL; | 634 return NULL; |
633 } | 635 } |
634 } | 636 } |
635 | 637 |
636 }()); | 638 }()); |
637 | 639 |
638 // Shortcut to save typing now that this is the only way to show the debug log. | 640 // Shortcut to save typing now that this is the only way to show the debug log. |
639 var tdl = remoting.toggleDebugLog; | 641 var tdl = remoting.toggleDebugLog; |
OLD | NEW |