Index: remoting/webapp/host_screen.js |
diff --git a/remoting/webapp/host_screen.js b/remoting/webapp/host_screen.js |
index bfa3827b7d1f09f255857916c270cfecdcff5e26..d1a26fcb11de2e13684ea61ebe94229c2139f398 100644 |
--- a/remoting/webapp/host_screen.js |
+++ b/remoting/webapp/host_screen.js |
@@ -33,13 +33,25 @@ |
var hostInstallDialog = null; |
var tryInitializeDispatcher = function() { |
- hostDispatcher.initialize(onDispatcherInitialized, |
+ hostDispatcher.initialize(createPluginForIt2Me, |
+ onDispatcherInitialized, |
onDispatcherInitializationFailed); |
} |
+ /** @return {remoting.HostPlugin} */ |
+ var createPluginForIt2Me = function() { |
+ return remoting.createNpapiPlugin( |
+ document.getElementById('host-plugin-container')); |
+ } |
+ |
var onDispatcherInitialized = function () { |
- // Host already installed. |
- remoting.startHostUsingDispatcher_(hostDispatcher); |
+ if (hostDispatcher.usingNpapi()) { |
+ hostInstallDialog = new remoting.HostInstallDialog(); |
+ hostInstallDialog.show(tryInitializeDispatcher, onInstallError); |
+ } else { |
+ // Host alrady installed. |
+ remoting.startHostUsingDispatcher_(hostDispatcher); |
+ } |
}; |
/** @param {remoting.Error} error */ |
@@ -169,6 +181,8 @@ |
remoting.setMode(remoting.AppMode.HOST_SHARE_FINISHED); |
} |
} |
+ remoting.hostSession.cleanup(); |
+ |
} else if (state == remoting.HostSession.State.ERROR) { |
console.error('Host state: ERROR'); |
showShareError_(remoting.Error.UNEXPECTED); |