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

Unified Diff: remoting/webapp/host_dispatcher.js

Issue 232223003: Windows chromoting host installation via the NPAPI plugin (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unittests Created 6 years, 8 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
« no previous file with comments | « remoting/webapp/host_controller.js ('k') | remoting/webapp/host_setup_dialog.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/host_dispatcher.js
diff --git a/remoting/webapp/host_dispatcher.js b/remoting/webapp/host_dispatcher.js
index 5dd3bc9a1d183940c61921e17e93306f18fd561d..a156697f7e20c17dc168ee0ae4c6dae4b0aa91b0 100644
--- a/remoting/webapp/host_dispatcher.js
+++ b/remoting/webapp/host_dispatcher.js
@@ -34,12 +34,13 @@ remoting.HostDispatcher = function(createPluginCallback) {
/** @type {remoting.HostPlugin} @private */
this.npapiHost_ = null;
- /** @type {remoting.HostDispatcher.State} */
+ /** @type {remoting.HostDispatcher.State} @private */
this.state_ = remoting.HostDispatcher.State.UNKNOWN;
- /** @type {Array.<function()>} */
+ /** @type {Array.<function()>} @private */
this.pendingRequests_ = [];
+ /** @type {function():remoting.HostPlugin} @private */
this.createPluginCallback_ = createPluginCallback;
this.tryToInitialize_();
@@ -326,6 +327,34 @@ remoting.HostDispatcher.prototype.getUsageStatsConsent =
};
/**
+ * @param {function(remoting.HostController.AsyncResult):void} onDone
+ * @param {function(remoting.Error):void} onError
+ * @return {void}
+ */
+remoting.HostDispatcher.prototype.installHost = function(onDone, onError) {
+ switch (this.state_) {
+ case remoting.HostDispatcher.State.UNKNOWN:
+ this.pendingRequests_.push(
+ this.startDaemon.bind(this, config, consent, onDone, onError));
+ break;
+ case remoting.HostDispatcher.State.NATIVE_MESSAGING:
+ // Host already installed, no action needed.
+ onDone(remoting.HostController.AsyncResult.OK);
+ break;
+ case remoting.HostDispatcher.State.NPAPI:
+ try {
+ this.npapiHost_.installHost(onDone);
+ } catch (err) {
+ onError(remoting.Error.MISSING_PLUGIN);
+ }
+ break;
+ case remoting.HostDispatcher.State.NOT_INSTALLED:
+ onError(remoting.Error.MISSING_PLUGIN);
+ break;
+ }
+};
+
+/**
* @param {Object} config
* @param {boolean} consent
* @param {function(remoting.HostController.AsyncResult):void} onDone
« no previous file with comments | « remoting/webapp/host_controller.js ('k') | remoting/webapp/host_setup_dialog.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698