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

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: 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);
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()) {
49 } 60 hostInstallDialog = new remoting.HostInstallDialog();
61 if (navigator.platform == 'Win32') {
62 (/** @type {remoting.HostInstallDialog} */ hostInstallDialog).show(
Jamie 2014/05/20 21:43:06 I don't think you need this type-cast.
63 hostDispatcher.getNpapiHost(), onHostInstalled, onInstallError);
64 } else {
65 (/** @type {remoting.HostInstallDialog} */ hostInstallDialog).show(
66 null, onHostInstalled, onInstallError);
67 }
68 } else {
69 // Host alrady installed.
70 remoting.startHostUsingDispatcher_(hostDispatcher);
71 }
72 };
50 73
51 /** @param {remoting.Error} error */ 74 /** @param {remoting.Error} error */
52 var onDispatcherInitializationFailed = function(error) { 75 var onDispatcherInitializationFailed = function(error) {
53 if (error != remoting.Error.MISSING_PLUGIN) { 76 if (error != remoting.Error.MISSING_PLUGIN) {
54 showShareError_(error); 77 showShareError_(error);
55 return; 78 return;
56 } 79 }
57 80
58 // If we failed to initialize dispatcher then prompt the user to install the 81 // If we failed to initialize the dispatcher then prompt the user to install
59 // host. 82 // the host manually.
60 if (hostInstallDialog == null) { 83 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(); 84 hostInstallDialog = new remoting.HostInstallDialog();
69 85
70 (/** @type {remoting.HostInstallDialog} */ hostInstallDialog).show( 86 (/** @type {remoting.HostInstallDialog} */ hostInstallDialog).show(
71 null, 87 null, onHostInstalled, onInstallError);
72 onDone,
73 onInstallPromptError);
74 } else { 88 } else {
75 (/** @type {remoting.HostInstallDialog} */ hostInstallDialog).tryAgain(); 89 (/** @type {remoting.HostInstallDialog} */ hostInstallDialog).tryAgain();
76 } 90 }
77 } 91 };
78 92
79 /** @param {remoting.Error} error */ 93 /** @param {remoting.Error} error */
80 var onInstallPromptError = function(error) { 94 var onInstallError = function(error) {
81 if (error == remoting.Error.CANCELLED) { 95 if (error == remoting.Error.CANCELLED) {
82 remoting.setMode(remoting.AppMode.HOME); 96 remoting.setMode(remoting.AppMode.HOME);
83 } else { 97 } else {
84 showShareError_(error); 98 showShareError_(error);
85 } 99 }
86 } 100 }
87 101
88 tryInitializeDispatcher(); 102 tryInitializeDispatcher();
89 }; 103 };
90 104
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 * @private 371 * @private
358 */ 372 */
359 function onNatTraversalPolicyChanged_(enabled) { 373 function onNatTraversalPolicyChanged_(enabled) {
360 var natBox = document.getElementById('nat-box'); 374 var natBox = document.getElementById('nat-box');
361 if (enabled) { 375 if (enabled) {
362 natBox.classList.add('traversal-enabled'); 376 natBox.classList.add('traversal-enabled');
363 } else { 377 } else {
364 natBox.classList.remove('traversal-enabled'); 378 natBox.classList.remove('traversal-enabled');
365 } 379 }
366 } 380 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698