Commit e89a5b72 authored by kelvinp's avatar kelvinp Committed by Commit bot

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}
parent 8531e3ec
...@@ -30,12 +30,3 @@ remoting.getChromeMajorVersion = function() { ...@@ -30,12 +30,3 @@ remoting.getChromeMajorVersion = function() {
} }
return 0; 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/);
}
...@@ -716,7 +716,7 @@ remoting.ClientSession.prototype.applyRemapKeys_ = function(apply) { ...@@ -716,7 +716,7 @@ remoting.ClientSession.prototype.applyRemapKeys_ = function(apply) {
// By default, under ChromeOS, remap the right Control key to the right // By default, under ChromeOS, remap the right Control key to the right
// Win / Cmd key. // Win / Cmd key.
var remapKeys = this.remapKeys_; var remapKeys = this.remapKeys_;
if (remapKeys == '' && remoting.runningOnChromeOS()) { if (remapKeys == '' && remoting.platformIsChromeOS()) {
remapKeys = '0x0700e4>0x0700e7'; remapKeys = '0x0700e4>0x0700e7';
} }
......
...@@ -117,13 +117,17 @@ remoting.init = function() { ...@@ -117,13 +117,17 @@ remoting.init = function() {
remoting.initModalDialogs(); remoting.initModalDialogs();
if (isHostModeSupported_()) { isHostModeSupported_().then(
var noShare = document.getElementById('chrome-os-no-share'); /** @param {Boolean} supported */
noShare.parentNode.removeChild(noShare); function(supported){
} else { if (supported) {
var button = document.getElementById('share-button'); var noShare = document.getElementById('chrome-os-no-share');
button.disabled = true; 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 * @return {Promise} A promise that resolves to the id of the current
...@@ -203,16 +207,6 @@ remoting.init = function() { ...@@ -203,16 +207,6 @@ remoting.init = function() {
remoting.ClientPlugin.factory.preloadPlugin(); remoting.ClientPlugin.factory.preloadPlugin();
}; };
/**
* 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 * 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 * we detect that host native messaging components are not installed. In that
...@@ -249,7 +243,6 @@ remoting.onEmail = function(email) { ...@@ -249,7 +243,6 @@ remoting.onEmail = function(email) {
*/ */
remoting.initHomeScreenUi = function() { remoting.initHomeScreenUi = function() {
remoting.hostController = new remoting.HostController(); remoting.hostController = new remoting.HostController();
document.getElementById('share-button').disabled = !isIT2MeSupported_();
remoting.setMode(remoting.AppMode.HOME); remoting.setMode(remoting.AppMode.HOME);
remoting.hostSetupDialog = remoting.hostSetupDialog =
new remoting.HostSetupDialog(remoting.hostController); new remoting.HostSetupDialog(remoting.hostController);
...@@ -401,13 +394,20 @@ function pluginGotCopy_(eventUncast) { ...@@ -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_() { function isHostModeSupported_() {
// Currently, sharing on Chromebooks is not supported. if (!remoting.platformIsChromeOS()) {
return !remoting.runningOnChromeOS(); 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();
} }
/** /**
......
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