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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: remoting/webapp/host_screen.js
diff --git a/remoting/webapp/host_screen.js b/remoting/webapp/host_screen.js
index 45e9975bbf422a4c51c497df015241398d8ea874..71446ae86ca410ee005dca72efc59ea37d514dd2 100644
--- a/remoting/webapp/host_screen.js
+++ b/remoting/webapp/host_screen.js
@@ -38,15 +38,37 @@ remoting.tryShare = function() {
onDispatcherInitializationFailed);
}
- /** @return {remoting.HostPlugin} */
+ /** @return {remoting.HostPlugin} */
var createPluginForIt2Me = function() {
return remoting.createNpapiPlugin(
document.getElementById('host-plugin-container'));
}
+ /** @param {remoting.HostController.AsyncResult} asyncResult */
+ var onHostInstalled = function(asyncResult) {
+ if (asyncResult == remoting.HostController.AsyncResult.OK) {
+ tryInitializeDispatcher();
+ } else if (asyncResult == remoting.HostController.AsyncResult.CANCELLED) {
+ 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
+ } else {
+ onInstallError(remoting.Error.UNEXPECTED);
+ }
+ };
+
var onDispatcherInitialized = function () {
- remoting.startHostUsingDispatcher_(hostDispatcher);
- }
+ 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/
+ hostInstallDialog = new remoting.HostInstallDialog();
+ if (navigator.platform == 'Win32') {
+ hostInstallDialog.show(
+ hostDispatcher.getNpapiHost(), onHostInstalled, onInstallError);
+ } else {
+ hostInstallDialog.show(null, onHostInstalled, onInstallError);
+ }
+ } else {
+ // Host alrady installed.
+ remoting.startHostUsingDispatcher_(hostDispatcher);
+ }
+ };
/** @param {remoting.Error} error */
var onDispatcherInitializationFailed = function(error) {
@@ -55,29 +77,20 @@ remoting.tryShare = function() {
return;
}
- // If we failed to initialize dispatcher then prompt the user to install the
- // host.
+ // If we failed to initialize the dispatcher then prompt the user to install
+ // the host manually.
if (hostInstallDialog == null) {
- var onDone = function(asyncResult) {
- // TODO (weitaosu): Ignore asyncResult for now because it is not set
- // during manual host installation. We should fix it after switching
- // to automatic host installation on Windows.
- tryInitializeDispatcher();
- };
-
hostInstallDialog = new remoting.HostInstallDialog();
(/** @type {remoting.HostInstallDialog} */ hostInstallDialog).show(
- null,
- onDone,
- onInstallPromptError);
+ null, onHostInstalled, onInstallError);
} else {
(/** @type {remoting.HostInstallDialog} */ hostInstallDialog).tryAgain();
}
- }
+ };
/** @param {remoting.Error} error */
- var onInstallPromptError = function(error) {
+ var onInstallError = function(error) {
if (error == remoting.Error.CANCELLED) {
remoting.setMode(remoting.AppMode.HOME);
} else {

Powered by Google App Engine
This is Rietveld 408576698