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

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

Issue 291133004: Automatic host installation for IT2Me on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
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 '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 /**
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 */ 266 */
267 remoting.HostSetupDialog.prototype.startNewFlow_ = function(sequence) { 267 remoting.HostSetupDialog.prototype.startNewFlow_ = function(sequence) {
268 this.flow_ = new remoting.HostSetupFlow(sequence); 268 this.flow_ = new remoting.HostSetupFlow(sequence);
269 this.pinEntry_.value = ''; 269 this.pinEntry_.value = '';
270 this.pinConfirm_.value = ''; 270 this.pinConfirm_.value = '';
271 this.pinErrorDiv_.hidden = true; 271 this.pinErrorDiv_.hidden = true;
272 this.updateState_(); 272 this.updateState_();
273 }; 273 };
274 274
275 /** 275 /**
276 * @param {string} tag
277 * @private
278 */
279 remoting.HostSetupDialog.prototype.showProcessingMessage_ = function(tag) {
280 var messageDiv = document.getElementById('host-setup-processing-message');
281 l10n.localizeElementFromTag(messageDiv, tag);
282 remoting.setMode(remoting.AppMode.HOST_SETUP_PROCESSING);
283 }
284
285 /**
286 * Updates current UI mode according to the current state of the setup 276 * Updates current UI mode according to the current state of the setup
287 * flow and start the action corresponding to the current step (if 277 * flow and start the action corresponding to the current step (if
288 * any). 278 * any).
289 * @private 279 * @private
290 */ 280 */
291 remoting.HostSetupDialog.prototype.updateState_ = function() { 281 remoting.HostSetupDialog.prototype.updateState_ = function() {
292 remoting.updateLocalHostState(); 282 remoting.updateLocalHostState();
293 283
294 /** @param {string} tag1 284 /** @param {string} tag1
295 * @param {string=} opt_tag2 */ 285 * @param {string=} opt_tag2 */
(...skipping 16 matching lines...) Expand all
312 } 302 }
313 303
314 var state = this.flow_.getState(); 304 var state = this.flow_.getState();
315 if (state == remoting.HostSetupFlow.State.NONE) { 305 if (state == remoting.HostSetupFlow.State.NONE) {
316 this.hide(); 306 this.hide();
317 } else if (state == remoting.HostSetupFlow.State.ASK_PIN) { 307 } else if (state == remoting.HostSetupFlow.State.ASK_PIN) {
318 remoting.setMode(remoting.AppMode.HOST_SETUP_ASK_PIN); 308 remoting.setMode(remoting.AppMode.HOST_SETUP_ASK_PIN);
319 } else if (state == remoting.HostSetupFlow.State.INSTALL_HOST) { 309 } else if (state == remoting.HostSetupFlow.State.INSTALL_HOST) {
320 this.installHost_(); 310 this.installHost_();
321 } else if (state == remoting.HostSetupFlow.State.STARTING_HOST) { 311 } else if (state == remoting.HostSetupFlow.State.STARTING_HOST) {
322 this.showProcessingMessage_(/*i18n-content*/'HOST_SETUP_STARTING'); 312 remoting.showSetupProcessingMessage(/*i18n-content*/'HOST_SETUP_STARTING');
323 this.startHost_(); 313 this.startHost_();
324 } else if (state == remoting.HostSetupFlow.State.UPDATING_PIN) { 314 } else if (state == remoting.HostSetupFlow.State.UPDATING_PIN) {
325 this.showProcessingMessage_(/*i18n-content*/'HOST_SETUP_UPDATING_PIN'); 315 remoting.showSetupProcessingMessage(
316 /*i18n-content*/'HOST_SETUP_UPDATING_PIN');
326 this.updatePin_(); 317 this.updatePin_();
327 } else if (state == remoting.HostSetupFlow.State.STOPPING_HOST) { 318 } else if (state == remoting.HostSetupFlow.State.STOPPING_HOST) {
328 this.showProcessingMessage_(/*i18n-content*/'HOST_SETUP_STOPPING'); 319 remoting.showSetupProcessingMessage(/*i18n-content*/'HOST_SETUP_STOPPING');
329 this.stopHost_(); 320 this.stopHost_();
330 } else if (state == remoting.HostSetupFlow.State.HOST_STARTED) { 321 } else if (state == remoting.HostSetupFlow.State.HOST_STARTED) {
331 // TODO(jamiewalch): Only display the second string if the computer's power 322 // TODO(jamiewalch): Only display the second string if the computer's power
332 // management settings indicate that it's necessary. 323 // management settings indicate that it's necessary.
333 showDoneMessage(/*i18n-content*/'HOST_SETUP_STARTED', 324 showDoneMessage(/*i18n-content*/'HOST_SETUP_STARTED',
334 /*i18n-content*/'HOST_SETUP_STARTED_DISABLE_SLEEP'); 325 /*i18n-content*/'HOST_SETUP_STARTED_DISABLE_SLEEP');
335 } else if (state == remoting.HostSetupFlow.State.UPDATED_PIN) { 326 } else if (state == remoting.HostSetupFlow.State.UPDATED_PIN) {
336 showDoneMessage(/*i18n-content*/'HOST_SETUP_UPDATED_PIN'); 327 showDoneMessage(/*i18n-content*/'HOST_SETUP_UPDATED_PIN');
337 } else if (state == remoting.HostSetupFlow.State.HOST_STOPPED) { 328 } else if (state == remoting.HostSetupFlow.State.HOST_STOPPED) {
338 showDoneMessage(/*i18n-content*/'HOST_SETUP_STOPPED'); 329 showDoneMessage(/*i18n-content*/'HOST_SETUP_STOPPED');
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 } else { 380 } else {
390 // For Windows, report an error in the unlikely case that 381 // For Windows, report an error in the unlikely case that
391 // HostController.installHost reports AsyncResult.OK but the host is not 382 // HostController.installHost reports AsyncResult.OK but the host is not
392 // installed. 383 // installed.
393 console.error('The chromoting host is not installed.'); 384 console.error('The chromoting host is not installed.');
394 onError(remoting.Error.UNEXPECTED); 385 onError(remoting.Error.UNEXPECTED);
395 } 386 }
396 } 387 }
397 }; 388 };
398 389
399 if (navigator.platform == 'Win32') {
400 // Currently we show two dialogs (each with a UAC prompt) when a user
401 // enables the host for the first time, one for installing the host (by the
402 // plugin) and the other for starting the host (by the native messaging
403 // host). We'd like to reduce it to one but don't have a good solution
404 // right now.
405 // We also show the same message on the two dialogs because. We don't want
406 // to confuse the user by saying "Installing Remote Desktop" because in
407 // their mind "Remote Deskto" (the webapp) has already been installed.
408 that.showProcessingMessage_(/*i18n-content*/'HOST_SETUP_STARTING');
409 }
410
411 /** @type {remoting.HostInstallDialog} */ 390 /** @type {remoting.HostInstallDialog} */
412 var hostInstallDialog = new remoting.HostInstallDialog(); 391 var hostInstallDialog = new remoting.HostInstallDialog();
413 hostInstallDialog.show(this.hostController_, onDone, onError); 392 hostInstallDialog.show(
393 this.hostController_.getDispatcher().getNpapiHost(), onDone, onError);
414 } 394 }
415 395
416 /** 396 /**
417 * Registers and starts the host. 397 * Registers and starts the host.
418 */ 398 */
419 remoting.HostSetupDialog.prototype.startHost_ = function() { 399 remoting.HostSetupDialog.prototype.startHost_ = function() {
420 /** @type {remoting.HostSetupDialog} */ 400 /** @type {remoting.HostSetupDialog} */
421 var that = this; 401 var that = this;
422 /** @type {remoting.HostSetupFlow} */ 402 /** @type {remoting.HostSetupFlow} */
423 var flow = this.flow_; 403 var flow = this.flow_;
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 var c = pin.charAt(i); 566 var c = pin.charAt(i);
587 if ((c < '0') || (c > '9')) { 567 if ((c < '0') || (c > '9')) {
588 return false; 568 return false;
589 } 569 }
590 } 570 }
591 return true; 571 return true;
592 }; 572 };
593 573
594 /** @type {remoting.HostSetupDialog} */ 574 /** @type {remoting.HostSetupDialog} */
595 remoting.hostSetupDialog = null; 575 remoting.hostSetupDialog = null;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698