Move test for enabling/disabling It2Me Share button

Previously, this test was based on whether the Me2Me host
plugin was loaded. But if Native Messaging is supported, this
NPAPI instance will not get loaded, so the Share button test
should not depend on it.


BUG=173509
NOTRY=true

Review URL: https://chromiumcodereview.appspot.com/15017006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198812 0039d316-1c4b-4281-b951-d872f2087c98
parent e9901194
......@@ -12,9 +12,6 @@ remoting.HostController = function() {
/** @type {remoting.HostController} */
var that = this;
/** @type {boolean} @private */
this.pluginSupported_ = true;
/** @type {remoting.HostNativeMessaging} @private */
this.plugin_ = new remoting.HostNativeMessaging();
......@@ -39,12 +36,10 @@ remoting.HostController = function() {
console.log('Host version: ' + version);
}
};
that.pluginSupported_ = true;
try {
that.plugin_.getDaemonVersion(printVersion);
} catch (err) {
console.log('Host version not available.');
that.pluginSupported_ = false;
}
}
......@@ -73,16 +68,6 @@ remoting.HostController.AsyncResult = {
FAILED_DIRECTORY: 3
};
/**
* Checks whether or not the host plugin is valid.
*
* @return {boolean} True if the plugin is supported and loaded; false
* otherwise.
*/
remoting.HostController.prototype.isPluginSupported = function() {
return this.pluginSupported_;
};
/**
* @param {function(boolean, boolean, boolean):void} callback Callback to be
* called when done.
......
......@@ -65,6 +65,7 @@ found in the LICENSE file.
</section> <!-- loading-mode -->
<div id="daemon-plugin-container"></div>
<div id="host-plugin-container"></div>
<iframe id="wcs-sandbox" src="wcs_sandbox.html" hidden></iframe>
......@@ -446,8 +447,6 @@ found in the LICENSE file.
<button id="cancel-share-button" i18n-content="CANCEL"></button>
</div>
<div id="host-plugin-container"></div>
</div> <!-- host dialog -->
<div id="client-dialog"
......
......@@ -124,14 +124,28 @@ remoting.onEmail = function(email) {
document.getElementById('get-started-me2me').disabled = false;
};
/**
* Returns whether or not IT2Me is supported via the host NPAPI plugin.
*
* @return {boolean}
*/
function isIT2MeSupported_() {
var container = document.getElementById('host-plugin-container');
/** @type {remoting.HostPlugin} */
var plugin = remoting.HostSession.createPlugin();
container.appendChild(plugin);
var result = plugin.hasOwnProperty('REQUESTED_ACCESS_CODE');
container.removeChild(plugin);
return result;
}
/**
* initHomeScreenUi is called if the app is not starting up in session mode,
* and also if the user cancels pin entry or the connection in session mode.
*/
remoting.initHomeScreenUi = function() {
remoting.hostController = new remoting.HostController();
document.getElementById('share-button').disabled =
!remoting.hostController.isPluginSupported();
document.getElementById('share-button').disabled = !isIT2MeSupported_();
remoting.setMode(remoting.AppMode.HOME);
if (!remoting.oauth2.isAuthenticated()) {
document.getElementById('auth-dialog').hidden = false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment