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 * Entry point ('load' handler) for Chromoting webapp. | |
12 */ | |
13 remoting.initChromoting = function() { | |
14 remoting.initGlobalObjects(); | |
15 remoting.initIdentity(); | |
16 remoting.initIdentityEmail(remoting.onEmailAvailable); | |
17 | |
18 remoting.initElementEventHandlers(); | |
19 remoting.initGlobalEventHandlers(); | |
20 | |
21 if (base.isAppsV2()) { | |
22 remoting.fullscreen = new remoting.FullscreenAppsV2(); | |
23 remoting.windowFrame = new remoting.WindowFrame( | |
24 document.getElementById('title-bar')); | |
25 remoting.optionsMenu = remoting.windowFrame.createOptionsMenu(); | |
26 } else { | |
27 remoting.fullscreen = new remoting.FullscreenAppsV1(); | |
28 remoting.toolbar = new remoting.Toolbar( | |
29 document.getElementById('session-toolbar')); | |
30 remoting.optionsMenu = remoting.toolbar.createOptionsMenu(); | |
31 } | |
32 | |
33 remoting.initHostlist_(); | |
34 | |
35 var homeFeedback = new remoting.MenuButton( | |
36 document.getElementById('help-feedback-main')); | |
37 var toolbarFeedback = new remoting.MenuButton( | |
38 document.getElementById('help-feedback-toolbar')); | |
39 remoting.manageHelpAndFeedback( | |
40 document.getElementById('title-bar')); | |
41 remoting.manageHelpAndFeedback( | |
42 document.getElementById('help-feedback-toolbar')); | |
43 remoting.manageHelpAndFeedback( | |
44 document.getElementById('help-feedback-main')); | |
45 | |
46 remoting.windowShape.updateClientWindowShape(); | |
47 | |
48 remoting.showOrHideIT2MeUi(); | |
49 remoting.showOrHideMe2MeUi(); | |
50 | |
51 // For Apps v1, check the tab type to warn the user if they are not getting | |
52 // the best keyboard experience. | |
53 if (!base.isAppsV2() && !remoting.platformIsMac()) { | |
54 /** @param {boolean} isWindowed */ | |
55 var onIsWindowed = function(isWindowed) { | |
56 if (!isWindowed) { | |
57 document.getElementById('startup-mode-box-me2me').hidden = false; | |
58 document.getElementById('startup-mode-box-it2me').hidden = false; | |
59 } | |
60 }; | |
61 isWindowed_(onIsWindowed); | |
62 } | |
63 | |
64 remoting.ClientPlugin.factory.preloadPlugin(); | |
65 | |
66 } | |
67 | |
68 /** | |
69 * Display the user's email address and allow access to the rest of the app, | 11 * Display the user's email address and allow access to the rest of the app, |
70 * including parsing URL parameters. | 12 * including parsing URL parameters. |
71 * | 13 * |
72 * @param {string} email The user's email address. | 14 * @param {string} email The user's email address. |
73 * @return {void} Nothing. | 15 * @return {void} Nothing. |
74 */ | 16 */ |
75 remoting.onEmailAvailable = function(email, fullName) { | 17 remoting.onEmailAvailable = function(email, fullName) { |
76 document.getElementById('current-email').innerText = email; | 18 document.getElementById('current-email').innerText = email; |
77 document.getElementById('get-started-it2me').disabled = false; | 19 document.getElementById('get-started-it2me').disabled = false; |
78 document.getElementById('get-started-me2me').disabled = false; | 20 document.getElementById('get-started-me2me').disabled = false; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 if ('mode' in urlParams) { | 73 if ('mode' in urlParams) { |
132 if (urlParams['mode'] === 'me2me') { | 74 if (urlParams['mode'] === 'me2me') { |
133 var hostId = urlParams['hostId']; | 75 var hostId = urlParams['hostId']; |
134 remoting.connectMe2Me(hostId); | 76 remoting.connectMe2Me(hostId); |
135 return; | 77 return; |
136 } else if (urlParams['mode'] === 'hangout') { | 78 } else if (urlParams['mode'] === 'hangout') { |
137 /** @param {*} id */ | 79 /** @param {*} id */ |
138 getCurrentId().then(function(id) { | 80 getCurrentId().then(function(id) { |
139 /** @type {string} */ | 81 /** @type {string} */ |
140 var accessCode = urlParams['accessCode']; | 82 var accessCode = urlParams['accessCode']; |
141 remoting.ensureSessionConnector_(); | 83 var connector = remoting.app.getSessionConnector(); |
142 remoting.setMode(remoting.AppMode.CLIENT_CONNECTING); | 84 remoting.setMode(remoting.AppMode.CLIENT_CONNECTING); |
143 remoting.connector.connectIT2Me(accessCode); | 85 connector.connectIT2Me(accessCode); |
144 | 86 |
145 document.body.classList.add('hangout-remote-desktop'); | 87 document.body.classList.add('hangout-remote-desktop'); |
146 var senderId = /** @type {string} */ String(id); | 88 var senderId = /** @type {string} */ String(id); |
147 var hangoutSession = new remoting.HangoutSession(senderId); | 89 var hangoutSession = new remoting.HangoutSession(senderId); |
148 hangoutSession.init(); | 90 hangoutSession.init(); |
149 }); | 91 }); |
150 return; | 92 return; |
151 } | 93 } |
152 } | 94 } |
153 // No valid URL parameters, start up normally. | 95 // No valid URL parameters, start up normally. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 console.log('Pairing registry not supported by host.'); | 169 console.log('Pairing registry not supported by host.'); |
228 remoting.pairedClientManager.setPairedClients([]); | 170 remoting.pairedClientManager.setPairedClients([]); |
229 } | 171 } |
230 }; | 172 }; |
231 | 173 |
232 remoting.hostController.hasFeature( | 174 remoting.hostController.hasFeature( |
233 remoting.HostController.Feature.PAIRING_REGISTRY, onHasFeatureResponse); | 175 remoting.HostController.Feature.PAIRING_REGISTRY, onHasFeatureResponse); |
234 remoting.hostController.getLocalHostState(onHostState); | 176 remoting.hostController.getLocalHostState(onHostState); |
235 }; | 177 }; |
236 | 178 |
237 window.addEventListener('load', remoting.initChromoting, false); | 179 /** |
| 180 * Entry point ('load' handler) for Remote Desktop (CRD) webapp. |
| 181 */ |
| 182 remoting.initDesktopRemoting = function() { |
| 183 remoting.app = new remoting.Application(); |
| 184 var desktop_remoting = new remoting.DesktopRemoting(remoting.app); |
| 185 remoting.app.init(); |
| 186 }; |
| 187 |
| 188 window.addEventListener('load', remoting.initDesktopRemoting, false); |
OLD | NEW |