summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-13 01:55:36 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-13 01:55:36 +0000
commit6ed253dc4a7451cd40f8cb2fefc0b9a5eb44e24c (patch)
treea47ba522bc60231a07cdc872f48f92d49038ff7d /remoting
parent310d7775c2045bafd6beadc5deec6bf5da9df0fb (diff)
downloadchromium_src-6ed253dc4a7451cd40f8cb2fefc0b9a5eb44e24c.zip
chromium_src-6ed253dc4a7451cd40f8cb2fefc0b9a5eb44e24c.tar.gz
chromium_src-6ed253dc4a7451cd40f8cb2fefc0b9a5eb44e24c.tar.bz2
Minor cleanups in UI code that gets host state when webapp is stared
- Previously the UI was getting local host ID before getting state, but it doesn't make sense when host is not started. - 2 minor changes in HostList and HostController around host state initialization. BUG=149744 R=jamiewalch@chromium.org Review URL: https://codereview.chromium.org/160963003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250908 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/webapp/host_controller.js6
-rw-r--r--remoting/webapp/host_list.js5
-rw-r--r--remoting/webapp/remoting.js36
3 files changed, 23 insertions, 24 deletions
diff --git a/remoting/webapp/host_controller.js b/remoting/webapp/host_controller.js
index caa1060..eb5066d 100644
--- a/remoting/webapp/host_controller.js
+++ b/remoting/webapp/host_controller.js
@@ -428,8 +428,10 @@ remoting.HostController.prototype.updatePin = function(newPin, onDone,
* callback.
*/
remoting.HostController.prototype.getLocalHostState = function(onDone) {
- this.hostDispatcher_.getDaemonState(onDone, function() {
- onDone(remoting.HostController.State.NOT_IMPLEMENTED);
+ this.hostDispatcher_.getDaemonState(onDone, function(error) {
+ onDone(remoting.isMe2MeInstallable()
+ ? remoting.HostController.State.NOT_INSTALLED
+ : remoting.HostController.State.NOT_IMPLEMENTED);
});
};
diff --git a/remoting/webapp/host_list.js b/remoting/webapp/host_list.js
index 9a1fcb8..a32ee5d 100644
--- a/remoting/webapp/host_list.js
+++ b/remoting/webapp/host_list.js
@@ -80,9 +80,8 @@ remoting.HostList = function(table, noHosts, errorMsg, errorButton,
* @type {remoting.HostController.State}
* @private
*/
- this.localHostState_ = remoting.isMe2MeSupported()
- ? remoting.HostController.State.NOT_INSTALLED
- : remoting.HostController.State.NOT_IMPLEMENTED;
+ this.localHostState_ = remoting.HostController.State.UNKNOWN;
+
/**
* @type {number}
* @private
diff --git a/remoting/webapp/remoting.js b/remoting/webapp/remoting.js
index 966627b..8b69379 100644
--- a/remoting/webapp/remoting.js
+++ b/remoting/webapp/remoting.js
@@ -173,24 +173,18 @@ remoting.createNpapiPlugin = function(container) {
return /** @type {remoting.HostPlugin} */ (plugin);
};
-// TODO(sergeyu): We want to show Me2Me host controls only on some Linux
-// distributions that we know work properly with the chromoting host. Implement
-// dome detection mechanism and apply it here.
-/** @type {boolean} */
-remoting.supportedLinuxDistibutionDetected_ = false;
-
/**
+ * 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
+ * controls that allow to install and enable Me2Me host.
+ *
* @return {boolean}
*/
-remoting.isMe2MeSupported = function isMe2MeSupported() {
+remoting.isMe2MeInstallable = function() {
/** @type {string} */
var platform = navigator.platform;
-
- // Currently Me2Me is supported on Windows, OSX and some versions of Linux.
- return platform == 'Win32' || platform == 'MacIntel' ||
- ((platform == 'Linux x86_64' || platform == 'Linux i386') &&
- remoting.supportedLinuxDistibutionDetected_ &&
- !remoting.runningOnChromeOS());
+ return platform == 'Win32' || platform == 'MacIntel';
}
/**
@@ -238,17 +232,21 @@ remoting.initHomeScreenUi = function() {
*/
remoting.updateLocalHostState = function() {
/**
- * @param {string?} hostId Host id.
+ * @param {remoting.HostController.State} state Host state.
*/
- var onHostId = function(hostId) {
- remoting.hostController.getLocalHostState(onHostState.bind(null, hostId));
+ var onHostState = function(state) {
+ if (state == remoting.HostController.State.STARTED) {
+ remoting.hostController.getLocalHostId(onHostId.bind(null, state));
+ } else {
+ onHostId(state, null);
+ }
};
/**
- * @param {string?} hostId Host id.
* @param {remoting.HostController.State} state Host state.
+ * @param {string?} hostId Host id.
*/
- var onHostState = function(hostId, state) {
+ var onHostId = function(state, hostId) {
remoting.hostList.setLocalHostStateAndId(state, hostId);
remoting.hostList.display();
};
@@ -278,7 +276,7 @@ remoting.updateLocalHostState = function() {
remoting.hostController.hasFeature(
remoting.HostController.Feature.PAIRING_REGISTRY, onHasFeatureResponse);
- remoting.hostController.getLocalHostId(onHostId);
+ remoting.hostController.getLocalHostState(onHostState);
};
/**