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

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

Issue 299983002: Remove the NPAPI plugin from the webapp. (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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 var that = this; 346 var that = this;
347 /** @type {remoting.HostSetupFlow} */ 347 /** @type {remoting.HostSetupFlow} */
348 var flow = this.flow_; 348 var flow = this.flow_;
349 349
350 /** @param {remoting.Error} error */ 350 /** @param {remoting.Error} error */
351 var onError = function(error) { 351 var onError = function(error) {
352 flow.switchToErrorState(error); 352 flow.switchToErrorState(error);
353 that.updateState_(); 353 that.updateState_();
354 }; 354 };
355 355
356 /** @param {remoting.HostController.AsyncResult} asyncResult */ 356 var onDone = function() {
357 var onDone = function(asyncResult) { 357 that.hostController_.getLocalHostState(onHostState);
358 if (asyncResult == remoting.HostController.AsyncResult.OK) {
359 that.hostController_.getLocalHostState(onHostState);
360 } else if (asyncResult == remoting.HostController.AsyncResult.CANCELLED) {
361 onError(remoting.Error.CANCELLED);
362 } else {
363 onError(remoting.Error.UNEXPECTED);
364 }
365 }; 358 };
366 359
367 /** @param {remoting.HostController.State} state */ 360 /** @param {remoting.HostController.State} state */
368 var onHostState = function(state) { 361 var onHostState = function(state) {
369 var installed = 362 var installed =
370 state != remoting.HostController.State.NOT_INSTALLED && 363 state != remoting.HostController.State.NOT_INSTALLED &&
371 state != remoting.HostController.State.INSTALLING; 364 state != remoting.HostController.State.INSTALLING;
372 365
373 if (installed) { 366 if (installed) {
374 that.flow_.switchToNextStep(); 367 that.flow_.switchToNextStep();
375 that.updateState_(); 368 that.updateState_();
376 } else { 369 } else {
377 // For Mac/Linux, prompt the user again if the host is not installed. 370 // Prompt the user again if the host is not installed.
378 if (navigator.platform != 'Win32') { 371 hostInstallDialog.tryAgain();
379 hostInstallDialog.tryAgain();
380 } else {
381 // For Windows, report an error in the unlikely case that
382 // HostController.installHost reports AsyncResult.OK but the host is not
383 // installed.
384 console.error('The chromoting host is not installed.');
385 onError(remoting.Error.UNEXPECTED);
386 }
387 } 372 }
388 }; 373 };
389 374
390 /** @type {remoting.HostInstallDialog} */ 375 /** @type {remoting.HostInstallDialog} */
391 var hostInstallDialog = new remoting.HostInstallDialog(); 376 var hostInstallDialog = new remoting.HostInstallDialog();
392 hostInstallDialog.show( 377 hostInstallDialog.show(onDone, onError);
393 this.hostController_.getDispatcher().getNpapiHost(), onDone, onError);
394 } 378 }
395 379
396 /** 380 /**
397 * Registers and starts the host. 381 * Registers and starts the host.
398 */ 382 */
399 remoting.HostSetupDialog.prototype.startHost_ = function() { 383 remoting.HostSetupDialog.prototype.startHost_ = function() {
400 /** @type {remoting.HostSetupDialog} */ 384 /** @type {remoting.HostSetupDialog} */
401 var that = this; 385 var that = this;
402 /** @type {remoting.HostSetupFlow} */ 386 /** @type {remoting.HostSetupFlow} */
403 var flow = this.flow_; 387 var flow = this.flow_;
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 var c = pin.charAt(i); 550 var c = pin.charAt(i);
567 if ((c < '0') || (c > '9')) { 551 if ((c < '0') || (c > '9')) {
568 return false; 552 return false;
569 } 553 }
570 } 554 }
571 return true; 555 return true;
572 }; 556 };
573 557
574 /** @type {remoting.HostSetupDialog} */ 558 /** @type {remoting.HostSetupDialog} */
575 remoting.hostSetupDialog = null; 559 remoting.hostSetupDialog = null;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698