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

Side by Side Diff: remoting/webapp/client_screen.js

Issue 15685008: Show a 'remember me' checkbox in the web-app when connecting to a host that supports pairing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Improved PIN dialog layout. Created 7 years, 7 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * Functions related to the 'client screen' for Chromoting. 7 * Functions related to the 'client screen' for Chromoting.
8 */ 8 */
9 9
10 'use strict'; 10 'use strict';
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 * @param {function(string, string):void} onThirdPartyTokenFetched Callback. 258 * @param {function(string, string):void} onThirdPartyTokenFetched Callback.
259 */ 259 */
260 var fetchThirdPartyToken = function( 260 var fetchThirdPartyToken = function(
261 tokenUrl, hostPublicKey, scope, onThirdPartyTokenFetched) { 261 tokenUrl, hostPublicKey, scope, onThirdPartyTokenFetched) {
262 var thirdPartyTokenFetcher = new remoting.ThirdPartyTokenFetcher( 262 var thirdPartyTokenFetcher = new remoting.ThirdPartyTokenFetcher(
263 tokenUrl, hostPublicKey, scope, host.tokenUrlPatterns, 263 tokenUrl, hostPublicKey, scope, host.tokenUrlPatterns,
264 onThirdPartyTokenFetched); 264 onThirdPartyTokenFetched);
265 thirdPartyTokenFetcher.fetchToken(); 265 thirdPartyTokenFetcher.fetchToken();
266 }; 266 };
267 267
268 /** @param {function(string):void} onPinFetched */ 268 /**
269 var requestPin = function(onPinFetched) { 269 * @param {function(string):void} onPinFetched
270 * @param {boolean} supportsPairing
271 */
272 var requestPin = function(onPinFetched, supportsPairing) {
rmsousa 2013/05/23 00:14:59 Nit: Does javascript also have the convention of p
Jamie 2013/05/23 01:10:08 Done.
270 /** @type {Element} */ 273 /** @type {Element} */
271 var pinForm = document.getElementById('pin-form'); 274 var pinForm = document.getElementById('pin-form');
272 /** @type {Element} */ 275 /** @type {Element} */
273 var pinCancel = document.getElementById('cancel-pin-entry-button'); 276 var pinCancel = document.getElementById('cancel-pin-entry-button');
274 /** 277 /**
275 * Event handler for both the 'submit' and 'cancel' actions. Using 278 * Event handler for both the 'submit' and 'cancel' actions. Using
276 * a single handler for both greatly simplifies the task of making 279 * a single handler for both greatly simplifies the task of making
277 * them one-shot. If separate handlers were used, each would have 280 * them one-shot. If separate handlers were used, each would have
278 * to unregister both itself and the other. 281 * to unregister both itself and the other.
279 * 282 *
280 * @param {Event} event The click or submit event. 283 * @param {Event} event The click or submit event.
281 */ 284 */
282 var onSubmitOrCancel = function(event) { 285 var onSubmitOrCancel = function(event) {
283 pinForm.removeEventListener('submit', onSubmitOrCancel, false); 286 pinForm.removeEventListener('submit', onSubmitOrCancel, false);
284 pinCancel.removeEventListener('click', onSubmitOrCancel, false); 287 pinCancel.removeEventListener('click', onSubmitOrCancel, false);
285 var pinField = document.getElementById('pin-entry'); 288 var pinField = document.getElementById('pin-entry');
286 var pin = pinField.value; 289 var pin = pinField.value;
287 pinField.value = ''; 290 pinField.value = '';
288 if (event.target == pinForm) { 291 if (event.target == pinForm) {
289 event.preventDefault(); 292 event.preventDefault();
290 remoting.setMode(remoting.AppMode.CLIENT_CONNECTING); 293 remoting.setMode(remoting.AppMode.CLIENT_CONNECTING);
291 onPinFetched(pin); 294 onPinFetched(pin);
rmsousa 2013/05/23 00:14:59 Nit: add todo here
Jamie 2013/05/23 01:10:08 To check the state of the checkbox? That's actuall
rmsousa 2013/05/23 21:17:52 For the next CL: I think it's better to save the c
292 } else { 295 } else {
293 remoting.setMode(remoting.AppMode.HOME); 296 remoting.setMode(remoting.AppMode.HOME);
294 } 297 }
295 }; 298 };
296 pinForm.addEventListener('submit', onSubmitOrCancel, false); 299 pinForm.addEventListener('submit', onSubmitOrCancel, false);
297 pinCancel.addEventListener('click', onSubmitOrCancel, false); 300 pinCancel.addEventListener('click', onSubmitOrCancel, false);
298 301
302 var rememberPin = document.getElementById('remember-pin');
303 rememberPin.hidden = !supportsPairing;
304 var checkbox = /** @type {HTMLInputElement} */
305 document.getElementById('remember-pin-checkbox');
306 checkbox.checked = false;
299 var message = document.getElementById('pin-message'); 307 var message = document.getElementById('pin-message');
300 l10n.localizeElement(message, host.hostName); 308 l10n.localizeElement(message, host.hostName);
301 remoting.setMode(remoting.AppMode.CLIENT_PIN_PROMPT); 309 remoting.setMode(remoting.AppMode.CLIENT_PIN_PROMPT);
302 }; 310 };
303 remoting.connector.connectMe2Me(host, requestPin, fetchThirdPartyToken); 311 remoting.connector.connectMe2Me(host, requestPin, fetchThirdPartyToken);
304 }; 312 };
305 313
306 /** @param {remoting.ClientSession} clientSession */ 314 /** @param {remoting.ClientSession} clientSession */
307 remoting.onConnected = function(clientSession) { 315 remoting.onConnected = function(clientSession) {
308 remoting.clientSession = clientSession; 316 remoting.clientSession = clientSession;
309 remoting.clientSession.setOnStateChange(onClientStateChange_); 317 remoting.clientSession.setOnStateChange(onClientStateChange_);
310 setConnectionInterruptedButtonsText_(); 318 setConnectionInterruptedButtonsText_();
311 var connectedTo = document.getElementById('connected-to'); 319 var connectedTo = document.getElementById('connected-to');
312 connectedTo.innerText = clientSession.hostDisplayName; 320 connectedTo.innerText = clientSession.hostDisplayName;
313 remoting.setMode(remoting.AppMode.IN_SESSION); 321 remoting.setMode(remoting.AppMode.IN_SESSION);
314 remoting.toolbar.center(); 322 remoting.toolbar.center();
315 remoting.toolbar.preview(); 323 remoting.toolbar.preview();
316 remoting.clipboard.startSession(); 324 remoting.clipboard.startSession();
317 updateStatistics_(); 325 updateStatistics_();
318 }; 326 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698