diff options
author | kelvinp <kelvinp@chromium.org> | 2014-11-03 18:18:46 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-11-04 02:19:09 +0000 |
commit | e89a5b72055d39e46b92bb4bd71f18296b69a8bb (patch) | |
tree | e4b0bf6de2df4e2999e9a553fbf338f6f3400c45 /remoting | |
parent | 8531e3ec88f822b602041c475a586563623787bc (diff) | |
download | chromium_src-e89a5b72055d39e46b92bb4bd71f18296b69a8bb.zip chromium_src-e89a5b72055d39e46b92bb4bd71f18296b69a8bb.tar.gz chromium_src-e89a5b72055d39e46b92bb4bd71f18296b69a8bb.tar.bz2 |
Remote assistance on Chrome OS Part VI - Enable It2me on ChromeOS in the webapp
It2me is currently behind a flag on Chrome OS. This CL enables It2me on Chrome
OS in the webapp when the flag is enabled. It also removes the function
remoting.runningOnChromeOS() which does exactly the same thing as
remoting.platformIsChromeOS().
Review URL: https://codereview.chromium.org/695363002
Cr-Commit-Position: refs/heads/master@{#302550}
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/webapp/base/js/platform.js | 9 | ||||
-rw-r--r-- | remoting/webapp/crd/js/client_session.js | 2 | ||||
-rw-r--r-- | remoting/webapp/crd/js/remoting.js | 44 |
3 files changed, 23 insertions, 32 deletions
diff --git a/remoting/webapp/base/js/platform.js b/remoting/webapp/base/js/platform.js index ab01cc7..dfb909e 100644 --- a/remoting/webapp/base/js/platform.js +++ b/remoting/webapp/base/js/platform.js @@ -30,12 +30,3 @@ remoting.getChromeMajorVersion = function() { } return 0; }; - -/** - * Returns whether the app is running on ChromeOS. - * - * @return {boolean} True if the app is running on ChromeOS. - */ -remoting.runningOnChromeOS = function() { - return !!navigator.userAgent.match(/\bCrOS\b/); -} diff --git a/remoting/webapp/crd/js/client_session.js b/remoting/webapp/crd/js/client_session.js index 16eaf18..05421c6 100644 --- a/remoting/webapp/crd/js/client_session.js +++ b/remoting/webapp/crd/js/client_session.js @@ -716,7 +716,7 @@ remoting.ClientSession.prototype.applyRemapKeys_ = function(apply) { // By default, under ChromeOS, remap the right Control key to the right // Win / Cmd key. var remapKeys = this.remapKeys_; - if (remapKeys == '' && remoting.runningOnChromeOS()) { + if (remapKeys == '' && remoting.platformIsChromeOS()) { remapKeys = '0x0700e4>0x0700e7'; } diff --git a/remoting/webapp/crd/js/remoting.js b/remoting/webapp/crd/js/remoting.js index 50ff475..fd3aed0 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) { + 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,20 @@ function pluginGotCopy_(eventUncast) { } /** - * Returns whether Host mode is supported on this platform. + * Returns whether Host mode is supported on this platform for It2me. + * TODO(kelvinp): Remove this function once It2me is enabled on Chrome OS (See + * crbug.com/429860). * - * @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(); } /** |