Chromium Code Reviews| Index: remoting/webapp/crd/js/crd_main.js |
| diff --git a/remoting/webapp/crd/js/crd_main.js b/remoting/webapp/crd/js/crd_main.js |
| index e15020b8e005caf36459add84ce46e67d972d11c..a100d7b21da725d767d605e10db79384d975a6ca 100644 |
| --- a/remoting/webapp/crd/js/crd_main.js |
| +++ b/remoting/webapp/crd/js/crd_main.js |
| @@ -8,9 +8,16 @@ |
| var remoting = remoting || {}; |
| /** |
| + * @constructor |
| + * @implements {remoting.Application} |
| + */ |
| +remoting.RemoteDesktop = function() { |
|
Jamie
2014/12/04 22:56:58
I'm not a fan of this class name, but I'm not sure
garykac
2014/12/05 19:55:40
Changed to DesktopRemoting.
|
| +}; |
| + |
| +/** |
| * Entry point ('load' handler) for Chromoting webapp. |
| */ |
| -remoting.initChromoting = function() { |
| +remoting.RemoteDesktop.prototype.init = function() { |
| remoting.initGlobalObjects(); |
| remoting.initIdentity(); |
| remoting.initIdentityEmail(remoting.onEmailAvailable); |
| @@ -64,6 +71,52 @@ remoting.initChromoting = function() { |
| } |
| +remoting.RemoteDesktop.prototype.onConnected = function() { |
| + // Set the text on the buttons shown under the error message so that they are |
| + // easy to understand in the case where a successful connection failed, as |
| + // opposed to the case where a connection never succeeded. |
|
Jamie
2014/12/04 22:56:58
When does this get reverted? If we feel that we sh
garykac
2014/12/05 19:55:40
AFAICT, it doesn't get reverted. I've added a TODO
|
| + var button1 = document.getElementById('client-reconnect-button'); |
| + l10n.localizeElementFromTag(button1, /*i18n-content*/'RECONNECT'); |
| + button1.removeAttribute('autofocus'); |
| + var button2 = document.getElementById('client-finished-me2me-button'); |
| + l10n.localizeElementFromTag(button2, /*i18n-content*/'OK'); |
| + button2.setAttribute('autofocus', 'autofocus'); |
| + |
| + document.getElementById('access-code-entry').value = ''; |
| + remoting.setMode(remoting.AppMode.IN_SESSION); |
| + if (!base.isAppsV2()) { |
| + remoting.toolbar.center(); |
| + remoting.toolbar.preview(); |
| + } |
| +}; |
| + |
| +remoting.RemoteDesktop.prototype.onDisconnected = function() { |
| +}; |
| + |
| +remoting.RemoteDesktop.prototype.onHostStarted = function() { |
| +}; |
| + |
| +/** |
| + * @param {remoting.Error} errorTag The error to be localized and displayed. |
| + * @return {void} Nothing. |
| + */ |
| +remoting.RemoteDesktop.prototype.onError = function(errorTag) { |
| + var errorDiv = document.getElementById('connect-error-message'); |
| + l10n.localizeElementFromTag(errorDiv, /** @type {string} */ (errorTag)); |
| + |
| + var mode = remoting.clientSession ? remoting.clientSession.getMode() |
| + : remoting.connector.getConnectionMode(); |
|
Jamie
2014/12/04 22:56:58
Would it make sense for the SessionConnector and C
garykac
2014/12/05 19:55:40
I was originally doing that in a separate cl, but
|
| + if (mode == remoting.ClientSession.Mode.IT2ME) { |
| + remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME); |
| + remoting.hangoutSessionEvents.raiseEvent( |
| + remoting.hangoutSessionEvents.sessionStateChanged, |
| + remoting.ClientSession.State.FAILED |
| + ); |
| + } else { |
| + remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_ME2ME); |
| + } |
| +}; |
| + |
| /** |
| * Display the user's email address and allow access to the rest of the app, |
| * including parsing URL parameters. |
| @@ -233,4 +286,12 @@ remoting.updateLocalHostState = function() { |
| remoting.hostController.getLocalHostState(onHostState); |
| }; |
| -window.addEventListener('load', remoting.initChromoting, false); |
| +/** |
| + * Entry point ('load' handler) for Remote Desktop (CRD) webapp. |
| + */ |
| +remoting.initRemoteDesktop = function() { |
| + remoting.app = new remoting.RemoteDesktop(); |
| + remoting.app.init(); |
| +}; |
| + |
| +window.addEventListener('load', remoting.initRemoteDesktop, false); |