| 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
|
|
|