Chromium Code Reviews| Index: remoting/webapp/crd/js/remoting.js |
| diff --git a/remoting/webapp/crd/js/remoting.js b/remoting/webapp/crd/js/remoting.js |
| index 50ff475e495cc337a4e1365a6a2951c07c050c12..4a843c9938ae335b7da0e5e57c295354ee492938 100644 |
| --- a/remoting/webapp/crd/js/remoting.js |
| +++ b/remoting/webapp/crd/js/remoting.js |
| @@ -117,13 +117,17 @@ remoting.init = function() { |
| remoting.initModalDialogs(); |
| - if (isHostModeSupported_()) { |
| - var noShare = document.getElementById('chrome-os-no-share'); |
| - noShare.parentNode.removeChild(noShare); |
| - } else { |
| - var button = document.getElementById('share-button'); |
| - button.disabled = true; |
| - } |
| + isHostModeSupported_().then( |
| + /** @param {Boolean} supported */ |
| + function(supported){ |
| + if (supported) { |
|
Jamie
2014/11/03 19:41:34
Part of the responsibility of the init method is t
Jamie
2014/11/03 23:15:11
Given the difficulty in fixing this, the relative
|
| + var noShare = document.getElementById('chrome-os-no-share'); |
| + noShare.parentNode.removeChild(noShare); |
| + } else { |
| + var button = document.getElementById('share-button'); |
| + button.disabled = true; |
| + } |
| + }); |
| /** |
| * @return {Promise} A promise that resolves to the id of the current |
| @@ -204,16 +208,6 @@ remoting.init = function() { |
| }; |
| /** |
| - * Returns whether or not IT2Me is supported via the host NPAPI plugin. |
| - * |
| - * @return {boolean} |
| - */ |
| -function isIT2MeSupported_() { |
| - // Currently, IT2Me on Chromebooks is not supported. |
| - return !remoting.runningOnChromeOS(); |
| -} |
| - |
| -/** |
| * Returns true if the current platform is fully supported. It's only used when |
| * we detect that host native messaging components are not installed. In that |
| * case the result of this function determines if the webapp should show the |
| @@ -249,7 +243,6 @@ remoting.onEmail = function(email) { |
| */ |
| remoting.initHomeScreenUi = function() { |
| remoting.hostController = new remoting.HostController(); |
| - document.getElementById('share-button').disabled = !isIT2MeSupported_(); |
| remoting.setMode(remoting.AppMode.HOME); |
| remoting.hostSetupDialog = |
| new remoting.HostSetupDialog(remoting.hostController); |
| @@ -401,13 +394,18 @@ function pluginGotCopy_(eventUncast) { |
| } |
| /** |
| - * Returns whether Host mode is supported on this platform. |
| + * Returns whether Host mode is supported on this platform for It2me. |
| * |
| - * @return {boolean} True if Host mode is supported. |
| + * @return {Promise} Resolves to true if Host mode is supported. |
| */ |
| function isHostModeSupported_() { |
| - // Currently, sharing on Chromebooks is not supported. |
| - return !remoting.runningOnChromeOS(); |
| + if (!remoting.platformIsChromeOS()) { |
| + return Promise.resolve(true); |
| + } |
| + // Sharing on Chrome OS is currently behind a flag. |
| + // isInstalled() will return false if the flag is disabled. |
| + var hostInstaller = new remoting.HostInstaller(); |
| + return hostInstaller.isInstalled(); |
| } |
| /** |