| Index: remoting/webapp/host_it2me_dispatcher.js
|
| diff --git a/remoting/webapp/host_it2me_dispatcher.js b/remoting/webapp/host_it2me_dispatcher.js
|
| index 3c2fce7762380181038c9bc5921a916ed42dfc74..bd75a4f88de70aff02057d47b6a081964d3558f9 100644
|
| --- a/remoting/webapp/host_it2me_dispatcher.js
|
| +++ b/remoting/webapp/host_it2me_dispatcher.js
|
| @@ -5,12 +5,9 @@
|
| /**
|
| * @fileoverview
|
| * This class provides an interface between the HostSession and either the
|
| - * NativeMessaging Host or the Host NPAPI plugin, depending on whether or not
|
| - * NativeMessaging is supported. Since the test for NativeMessaging support is
|
| - * asynchronous, the connection is attemped on either the the NativeMessaging
|
| - * host or the NPAPI plugin once the test is complete.
|
| + * NativeMessaging Host
|
| *
|
| - * TODO(sergeyu): Remove this class once the NPAPI plugin is dropped.
|
| + * TODO(sergeyu): Remove this class.
|
| */
|
|
|
| 'use strict';
|
| @@ -28,20 +25,12 @@ remoting.HostIt2MeDispatcher = function() {
|
| this.nativeMessagingHost_ = null;
|
|
|
| /**
|
| - * @type {remoting.HostPlugin}
|
| - * @private */
|
| - this.npapiHost_ = null;
|
| -
|
| - /**
|
| * @param {remoting.Error} error
|
| * @private */
|
| this.onErrorHandler_ = function(error) {}
|
| };
|
|
|
| /**
|
| - * @param {function():remoting.HostPlugin} createPluginCallback Callback to
|
| - * instantiate the NPAPI plugin when NativeMessaging is determined to be
|
| - * unsupported.
|
| * @param {function():void} onDispatcherInitialized Callback to be called after
|
| * initialization has finished successfully.
|
| * @param {function(remoting.Error):void} onDispatcherInitializationFailed
|
| @@ -49,31 +38,18 @@ remoting.HostIt2MeDispatcher = function() {
|
| * plugin works.
|
| */
|
| remoting.HostIt2MeDispatcher.prototype.initialize =
|
| - function(createPluginCallback, onDispatcherInitialized,
|
| + function(onDispatcherInitialized,
|
| onDispatcherInitializationFailed) {
|
| /** @type {remoting.HostIt2MeDispatcher} */
|
| var that = this;
|
|
|
| function onNativeMessagingStarted() {
|
| - console.log('Native Messaging supported.');
|
| -
|
| - that.npapiHost_ = null;
|
| onDispatcherInitialized();
|
| }
|
|
|
| function onNativeMessagingInitFailed() {
|
| - console.log('Native Messaging unsupported, falling back to NPAPI.');
|
| -
|
| that.nativeMessagingHost_ = null;
|
| - that.npapiHost_ = createPluginCallback();
|
| -
|
| - // TODO(weitaosu): is there a better way to check whether NPAPI plugin is
|
| - // supported?
|
| - if (that.npapiHost_) {
|
| - onDispatcherInitialized();
|
| - } else {
|
| - onDispatcherInitializationFailed(remoting.Error.MISSING_PLUGIN);
|
| - }
|
| + onDispatcherInitializationFailed(remoting.Error.MISSING_PLUGIN);
|
| }
|
|
|
| this.nativeMessagingHost_ = new remoting.HostIt2MeNativeMessaging();
|
| @@ -92,20 +68,6 @@ remoting.HostIt2MeDispatcher.prototype.onNativeMessagingError_ =
|
| }
|
|
|
| /**
|
| - * @return {boolean}
|
| - */
|
| -remoting.HostIt2MeDispatcher.prototype.usingNpapi = function() {
|
| - return this.npapiHost_ != null;
|
| -}
|
| -
|
| -/**
|
| - * @return {remoting.HostPlugin}
|
| - */
|
| -remoting.HostIt2MeDispatcher.prototype.getNpapiHost = function() {
|
| - return this.npapiHost_;
|
| -}
|
| -
|
| -/**
|
| * @param {string} email The user's email address.
|
| * @param {string} authServiceWithToken Concatenation of the auth service
|
| * (e.g. oauth2) and the access token.
|
| @@ -133,15 +95,6 @@ remoting.HostIt2MeDispatcher.prototype.connect =
|
| this.nativeMessagingHost_.connect(
|
| email, authServiceWithToken, onStateChanged, onNatPolicyChanged,
|
| xmppServerAddress, xmppServerUseTls, directoryBotJid);
|
| - } else if (this.npapiHost_) {
|
| - this.npapiHost_.xmppServerAddress = xmppServerAddress;
|
| - this.npapiHost_.xmppServerUseTls = xmppServerUseTls;
|
| - this.npapiHost_.directoryBotJid = directoryBotJid;
|
| - this.npapiHost_.onStateChanged = onStateChanged;
|
| - this.npapiHost_.onNatTraversalPolicyChanged = onNatPolicyChanged;
|
| - this.npapiHost_.logDebugInfo = logDebugInfo;
|
| - this.npapiHost_.localize(chrome.i18n.getMessage);
|
| - this.npapiHost_.connect(email, authServiceWithToken);
|
| } else {
|
| console.error(
|
| 'remoting.HostIt2MeDispatcher.connect() without initialization.');
|
| @@ -153,51 +106,26 @@ remoting.HostIt2MeDispatcher.prototype.connect =
|
| * @return {void}
|
| */
|
| remoting.HostIt2MeDispatcher.prototype.disconnect = function() {
|
| - if (this.npapiHost_) {
|
| - this.npapiHost_.disconnect();
|
| - } else {
|
| - this.nativeMessagingHost_.disconnect();
|
| - }
|
| + this.nativeMessagingHost_.disconnect();
|
| };
|
|
|
| /**
|
| * @return {string} The access code generated by the it2me host.
|
| */
|
| remoting.HostIt2MeDispatcher.prototype.getAccessCode = function() {
|
| - if (this.npapiHost_) {
|
| - return this.npapiHost_.accessCode;
|
| - } else {
|
| - return this.nativeMessagingHost_.getAccessCode();
|
| - }
|
| + return this.nativeMessagingHost_.getAccessCode();
|
| };
|
|
|
| /**
|
| * @return {number} The access code lifetime, in seconds.
|
| */
|
| remoting.HostIt2MeDispatcher.prototype.getAccessCodeLifetime = function() {
|
| - if (this.npapiHost_) {
|
| - return this.npapiHost_.accessCodeLifetime;
|
| - } else {
|
| - return this.nativeMessagingHost_.getAccessCodeLifetime();
|
| - }
|
| + return this.nativeMessagingHost_.getAccessCodeLifetime();
|
| };
|
|
|
| /**
|
| * @return {string} The client's email address.
|
| */
|
| remoting.HostIt2MeDispatcher.prototype.getClient = function() {
|
| - if (this.npapiHost_) {
|
| - return this.npapiHost_.client;
|
| - } else {
|
| - return this.nativeMessagingHost_.getClient();
|
| - }
|
| -};
|
| -
|
| -/**
|
| - * @return {void}
|
| - */
|
| -remoting.HostIt2MeDispatcher.prototype.cleanup = function() {
|
| - if (this.npapiHost_) {
|
| - this.npapiHost_.parentNode.removeChild(this.npapiHost_);
|
| - }
|
| + return this.nativeMessagingHost_.getClient();
|
| };
|
|
|