Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: remoting/webapp/crd/js/crd_main.js

Issue 779613003: [Chromoting] Create core Application interface for CRD. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move setupConnection into Application Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.initEventHandlers();
19
20 if (base.isAppsV2()) {
21 remoting.fullscreen = new remoting.FullscreenAppsV2();
22 remoting.windowFrame = new remoting.WindowFrame(
23 document.getElementById('title-bar'));
24 remoting.optionsMenu = remoting.windowFrame.createOptionsMenu();
25 } else {
26 remoting.fullscreen = new remoting.FullscreenAppsV1();
27 remoting.toolbar = new remoting.Toolbar(
28 document.getElementById('session-toolbar'));
29 remoting.optionsMenu = remoting.toolbar.createOptionsMenu();
30 }
31
32 remoting.initHostlist_();
33
34 var homeFeedback = new remoting.MenuButton(
35 document.getElementById('help-feedback-main'));
36 var toolbarFeedback = new remoting.MenuButton(
37 document.getElementById('help-feedback-toolbar'));
38 remoting.manageHelpAndFeedback(
39 document.getElementById('title-bar'));
40 remoting.manageHelpAndFeedback(
41 document.getElementById('help-feedback-toolbar'));
42 remoting.manageHelpAndFeedback(
43 document.getElementById('help-feedback-main'));
44
45 remoting.windowShape.updateClientWindowShape();
46
47 remoting.showOrHideIT2MeUi();
48 remoting.showOrHideMe2MeUi();
49
50 // For Apps v1, check the tab type to warn the user if they are not getting
51 // the best keyboard experience.
52 if (!base.isAppsV2() && !remoting.platformIsMac()) {
53 /** @param {boolean} isWindowed */
54 var onIsWindowed = function(isWindowed) {
55 if (!isWindowed) {
56 document.getElementById('startup-mode-box-me2me').hidden = false;
57 document.getElementById('startup-mode-box-it2me').hidden = false;
58 }
59 };
60 isWindowed_(onIsWindowed);
61 }
62
63 remoting.ClientPlugin.factory.preloadPlugin();
64
65 }
66
67 /**
68 * 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,
69 * including parsing URL parameters. 12 * including parsing URL parameters.
70 * 13 *
71 * @param {string} email The user's email address. 14 * @param {string} email The user's email address.
72 * @return {void} Nothing. 15 * @return {void} Nothing.
73 */ 16 */
74 remoting.onEmailAvailable = function(email, fullName) { 17 remoting.onEmailAvailable = function(email, fullName) {
75 document.getElementById('current-email').innerText = email; 18 document.getElementById('current-email').innerText = email;
76 document.getElementById('get-started-it2me').disabled = false; 19 document.getElementById('get-started-it2me').disabled = false;
77 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
130 if ('mode' in urlParams) { 73 if ('mode' in urlParams) {
131 if (urlParams['mode'] === 'me2me') { 74 if (urlParams['mode'] === 'me2me') {
132 var hostId = urlParams['hostId']; 75 var hostId = urlParams['hostId'];
133 remoting.connectMe2Me(hostId); 76 remoting.connectMe2Me(hostId);
134 return; 77 return;
135 } else if (urlParams['mode'] === 'hangout') { 78 } else if (urlParams['mode'] === 'hangout') {
136 /** @param {*} id */ 79 /** @param {*} id */
137 getCurrentId().then(function(id) { 80 getCurrentId().then(function(id) {
138 /** @type {string} */ 81 /** @type {string} */
139 var accessCode = urlParams['accessCode']; 82 var accessCode = urlParams['accessCode'];
140 remoting.ensureSessionConnector_(); 83 var connector = remoting.app.getSessionConnector();
141 remoting.setMode(remoting.AppMode.CLIENT_CONNECTING); 84 remoting.setMode(remoting.AppMode.CLIENT_CONNECTING);
142 remoting.connector.connectIT2Me(accessCode); 85 connector.connectIT2Me(accessCode);
143 86
144 document.body.classList.add('hangout-remote-desktop'); 87 document.body.classList.add('hangout-remote-desktop');
145 var senderId = /** @type {string} */ String(id); 88 var senderId = /** @type {string} */ String(id);
146 var hangoutSession = new remoting.HangoutSession(senderId); 89 var hangoutSession = new remoting.HangoutSession(senderId);
147 hangoutSession.init(); 90 hangoutSession.init();
148 }); 91 });
149 return; 92 return;
150 } 93 }
151 } 94 }
152 // 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
226 console.log('Pairing registry not supported by host.'); 169 console.log('Pairing registry not supported by host.');
227 remoting.pairedClientManager.setPairedClients([]); 170 remoting.pairedClientManager.setPairedClients([]);
228 } 171 }
229 }; 172 };
230 173
231 remoting.hostController.hasFeature( 174 remoting.hostController.hasFeature(
232 remoting.HostController.Feature.PAIRING_REGISTRY, onHasFeatureResponse); 175 remoting.HostController.Feature.PAIRING_REGISTRY, onHasFeatureResponse);
233 remoting.hostController.getLocalHostState(onHostState); 176 remoting.hostController.getLocalHostState(onHostState);
234 }; 177 };
235 178
236 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);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698