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

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

Issue 291133004: Automatic host installation for IT2Me on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing CR feedback. 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 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * Functions related to the 'host screen' for Chromoting. 7 * Functions related to the 'host screen' for Chromoting.
8 */ 8 */
9 9
10 'use strict'; 10 'use strict';
(...skipping 20 matching lines...) Expand all
31 31
32 /** @type {remoting.HostInstallDialog} */ 32 /** @type {remoting.HostInstallDialog} */
33 var hostInstallDialog = null; 33 var hostInstallDialog = null;
34 34
35 var tryInitializeDispatcher = function() { 35 var tryInitializeDispatcher = function() {
36 hostDispatcher.initialize(createPluginForIt2Me, 36 hostDispatcher.initialize(createPluginForIt2Me,
37 onDispatcherInitialized, 37 onDispatcherInitialized,
38 onDispatcherInitializationFailed); 38 onDispatcherInitializationFailed);
39 } 39 }
40 40
41 /** @return {remoting.HostPlugin} */ 41 /** @return {remoting.HostPlugin} */
42 var createPluginForIt2Me = function() { 42 var createPluginForIt2Me = function() {
43 return remoting.createNpapiPlugin( 43 return remoting.createNpapiPlugin(
44 document.getElementById('host-plugin-container')); 44 document.getElementById('host-plugin-container'));
45 } 45 }
46 46
47 /** @param {remoting.HostController.AsyncResult} asyncResult */
48 var onHostInstalled = function(asyncResult) {
49 if (asyncResult == remoting.HostController.AsyncResult.OK) {
50 tryInitializeDispatcher();
51 } else if (asyncResult == remoting.HostController.AsyncResult.CANCELLED) {
52 onInstallError(remoting.Error.CANCELLED);
Sergey Ulanov 2014/05/21 03:21:59 Why doesn't HostInstallDialog call onInstallError(
weitao 2014/05/21 18:04:22 Good point. Will fix this. On 2014/05/21 03:21:59
53 } else {
54 onInstallError(remoting.Error.UNEXPECTED);
55 }
56 };
57
47 var onDispatcherInitialized = function () { 58 var onDispatcherInitialized = function () {
48 remoting.startHostUsingDispatcher_(hostDispatcher); 59 if (hostDispatcher.usingNpapi()) {
Sergey Ulanov 2014/05/21 03:21:59 nit: This wouldn't be necessary if HostIt2MeDispat
weitao 2014/05/21 18:04:22 Yes this is planned in my next CL. :) On 2014/05/
49 } 60 hostInstallDialog = new remoting.HostInstallDialog();
61 if (navigator.platform == 'Win32') {
62 hostInstallDialog.show(
63 hostDispatcher.getNpapiHost(), onHostInstalled, onInstallError);
64 } else {
65 hostInstallDialog.show(null, onHostInstalled, onInstallError);
66 }
67 } else {
68 // Host alrady installed.
69 remoting.startHostUsingDispatcher_(hostDispatcher);
70 }
71 };
50 72
51 /** @param {remoting.Error} error */ 73 /** @param {remoting.Error} error */
52 var onDispatcherInitializationFailed = function(error) { 74 var onDispatcherInitializationFailed = function(error) {
53 if (error != remoting.Error.MISSING_PLUGIN) { 75 if (error != remoting.Error.MISSING_PLUGIN) {
54 showShareError_(error); 76 showShareError_(error);
55 return; 77 return;
56 } 78 }
57 79
58 // If we failed to initialize dispatcher then prompt the user to install the 80 // If we failed to initialize the dispatcher then prompt the user to install
59 // host. 81 // the host manually.
60 if (hostInstallDialog == null) { 82 if (hostInstallDialog == null) {
61 var onDone = function(asyncResult) {
62 // TODO (weitaosu): Ignore asyncResult for now because it is not set
63 // during manual host installation. We should fix it after switching
64 // to automatic host installation on Windows.
65 tryInitializeDispatcher();
66 };
67
68 hostInstallDialog = new remoting.HostInstallDialog(); 83 hostInstallDialog = new remoting.HostInstallDialog();
69 84
70 (/** @type {remoting.HostInstallDialog} */ hostInstallDialog).show( 85 (/** @type {remoting.HostInstallDialog} */ hostInstallDialog).show(
71 null, 86 null, onHostInstalled, onInstallError);
72 onDone,
73 onInstallPromptError);
74 } else { 87 } else {
75 (/** @type {remoting.HostInstallDialog} */ hostInstallDialog).tryAgain(); 88 (/** @type {remoting.HostInstallDialog} */ hostInstallDialog).tryAgain();
76 } 89 }
77 } 90 };
78 91
79 /** @param {remoting.Error} error */ 92 /** @param {remoting.Error} error */
80 var onInstallPromptError = function(error) { 93 var onInstallError = function(error) {
81 if (error == remoting.Error.CANCELLED) { 94 if (error == remoting.Error.CANCELLED) {
82 remoting.setMode(remoting.AppMode.HOME); 95 remoting.setMode(remoting.AppMode.HOME);
83 } else { 96 } else {
84 showShareError_(error); 97 showShareError_(error);
85 } 98 }
86 } 99 }
87 100
88 tryInitializeDispatcher(); 101 tryInitializeDispatcher();
89 }; 102 };
90 103
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 * @private 370 * @private
358 */ 371 */
359 function onNatTraversalPolicyChanged_(enabled) { 372 function onNatTraversalPolicyChanged_(enabled) {
360 var natBox = document.getElementById('nat-box'); 373 var natBox = document.getElementById('nat-box');
361 if (enabled) { 374 if (enabled) {
362 natBox.classList.add('traversal-enabled'); 375 natBox.classList.add('traversal-enabled');
363 } else { 376 } else {
364 natBox.classList.remove('traversal-enabled'); 377 natBox.classList.remove('traversal-enabled');
365 } 378 }
366 } 379 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698