Chromium Code Reviews| 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** @suppress {duplicate} */ | 7 /** @suppress {duplicate} */ |
| 8 var remoting = remoting || {}; | 8 var remoting = remoting || {}; |
| 9 | 9 |
| 10 /** | 10 /** |
| 11 * @constructor | |
| 12 * @implements {remoting.Application} | |
| 13 */ | |
| 14 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.
| |
| 15 }; | |
| 16 | |
| 17 /** | |
| 11 * Entry point ('load' handler) for Chromoting webapp. | 18 * Entry point ('load' handler) for Chromoting webapp. |
| 12 */ | 19 */ |
| 13 remoting.initChromoting = function() { | 20 remoting.RemoteDesktop.prototype.init = function() { |
| 14 remoting.initGlobalObjects(); | 21 remoting.initGlobalObjects(); |
| 15 remoting.initIdentity(); | 22 remoting.initIdentity(); |
| 16 remoting.initIdentityEmail(remoting.onEmailAvailable); | 23 remoting.initIdentityEmail(remoting.onEmailAvailable); |
| 17 | 24 |
| 18 remoting.initEventHandlers(); | 25 remoting.initEventHandlers(); |
| 19 | 26 |
| 20 if (base.isAppsV2()) { | 27 if (base.isAppsV2()) { |
| 21 remoting.fullscreen = new remoting.FullscreenAppsV2(); | 28 remoting.fullscreen = new remoting.FullscreenAppsV2(); |
| 22 remoting.windowFrame = new remoting.WindowFrame( | 29 remoting.windowFrame = new remoting.WindowFrame( |
| 23 document.getElementById('title-bar')); | 30 document.getElementById('title-bar')); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 57 document.getElementById('startup-mode-box-it2me').hidden = false; | 64 document.getElementById('startup-mode-box-it2me').hidden = false; |
| 58 } | 65 } |
| 59 }; | 66 }; |
| 60 isWindowed_(onIsWindowed); | 67 isWindowed_(onIsWindowed); |
| 61 } | 68 } |
| 62 | 69 |
| 63 remoting.ClientPlugin.factory.preloadPlugin(); | 70 remoting.ClientPlugin.factory.preloadPlugin(); |
| 64 | 71 |
| 65 } | 72 } |
| 66 | 73 |
| 74 remoting.RemoteDesktop.prototype.onConnected = function() { | |
| 75 // Set the text on the buttons shown under the error message so that they are | |
| 76 // easy to understand in the case where a successful connection failed, as | |
| 77 // 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
| |
| 78 var button1 = document.getElementById('client-reconnect-button'); | |
| 79 l10n.localizeElementFromTag(button1, /*i18n-content*/'RECONNECT'); | |
| 80 button1.removeAttribute('autofocus'); | |
| 81 var button2 = document.getElementById('client-finished-me2me-button'); | |
| 82 l10n.localizeElementFromTag(button2, /*i18n-content*/'OK'); | |
| 83 button2.setAttribute('autofocus', 'autofocus'); | |
| 84 | |
| 85 document.getElementById('access-code-entry').value = ''; | |
| 86 remoting.setMode(remoting.AppMode.IN_SESSION); | |
| 87 if (!base.isAppsV2()) { | |
| 88 remoting.toolbar.center(); | |
| 89 remoting.toolbar.preview(); | |
| 90 } | |
| 91 }; | |
| 92 | |
| 93 remoting.RemoteDesktop.prototype.onDisconnected = function() { | |
| 94 }; | |
| 95 | |
| 96 remoting.RemoteDesktop.prototype.onHostStarted = function() { | |
| 97 }; | |
| 98 | |
| 99 /** | |
| 100 * @param {remoting.Error} errorTag The error to be localized and displayed. | |
| 101 * @return {void} Nothing. | |
| 102 */ | |
| 103 remoting.RemoteDesktop.prototype.onError = function(errorTag) { | |
| 104 var errorDiv = document.getElementById('connect-error-message'); | |
| 105 l10n.localizeElementFromTag(errorDiv, /** @type {string} */ (errorTag)); | |
| 106 | |
| 107 var mode = remoting.clientSession ? remoting.clientSession.getMode() | |
| 108 : 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
| |
| 109 if (mode == remoting.ClientSession.Mode.IT2ME) { | |
| 110 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME); | |
| 111 remoting.hangoutSessionEvents.raiseEvent( | |
| 112 remoting.hangoutSessionEvents.sessionStateChanged, | |
| 113 remoting.ClientSession.State.FAILED | |
| 114 ); | |
| 115 } else { | |
| 116 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_ME2ME); | |
| 117 } | |
| 118 }; | |
| 119 | |
| 67 /** | 120 /** |
| 68 * Display the user's email address and allow access to the rest of the app, | 121 * Display the user's email address and allow access to the rest of the app, |
| 69 * including parsing URL parameters. | 122 * including parsing URL parameters. |
| 70 * | 123 * |
| 71 * @param {string} email The user's email address. | 124 * @param {string} email The user's email address. |
| 72 * @return {void} Nothing. | 125 * @return {void} Nothing. |
| 73 */ | 126 */ |
| 74 remoting.onEmailAvailable = function(email, fullName) { | 127 remoting.onEmailAvailable = function(email, fullName) { |
| 75 document.getElementById('current-email').innerText = email; | 128 document.getElementById('current-email').innerText = email; |
| 76 document.getElementById('get-started-it2me').disabled = false; | 129 document.getElementById('get-started-it2me').disabled = false; |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 console.log('Pairing registry not supported by host.'); | 279 console.log('Pairing registry not supported by host.'); |
| 227 remoting.pairedClientManager.setPairedClients([]); | 280 remoting.pairedClientManager.setPairedClients([]); |
| 228 } | 281 } |
| 229 }; | 282 }; |
| 230 | 283 |
| 231 remoting.hostController.hasFeature( | 284 remoting.hostController.hasFeature( |
| 232 remoting.HostController.Feature.PAIRING_REGISTRY, onHasFeatureResponse); | 285 remoting.HostController.Feature.PAIRING_REGISTRY, onHasFeatureResponse); |
| 233 remoting.hostController.getLocalHostState(onHostState); | 286 remoting.hostController.getLocalHostState(onHostState); |
| 234 }; | 287 }; |
| 235 | 288 |
| 236 window.addEventListener('load', remoting.initChromoting, false); | 289 /** |
| 290 * Entry point ('load' handler) for Remote Desktop (CRD) webapp. | |
| 291 */ | |
| 292 remoting.initRemoteDesktop = function() { | |
| 293 remoting.app = new remoting.RemoteDesktop(); | |
| 294 remoting.app.init(); | |
| 295 }; | |
| 296 | |
| 297 window.addEventListener('load', remoting.initRemoteDesktop, false); | |
| OLD | NEW |