summaryrefslogtreecommitdiffstats
path: root/remoting/webapp/host_table_entry.js
diff options
context:
space:
mode:
authorjamiewalch@google.com <jamiewalch@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-04 17:30:04 +0000
committerjamiewalch@google.com <jamiewalch@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-04 17:30:04 +0000
commit8b5b2cc18cf04d1ad6bfefb39f4e3a20b6ff866d (patch)
tree17d12112b2da6131d74ea5d3b01a8c42373806df /remoting/webapp/host_table_entry.js
parenta50f1a0f8e0fb4bba8c9433e0045be178469c26d (diff)
downloadchromium_src-8b5b2cc18cf04d1ad6bfefb39f4e3a20b6ff866d.zip
chromium_src-8b5b2cc18cf04d1ad6bfefb39f4e3a20b6ff866d.tar.gz
chromium_src-8b5b2cc18cf04d1ad6bfefb39f4e3a20b6ff866d.tar.bz2
Disable click-to-connect while the hostname is being edited.
BUG=121509 TEST=Manual Review URL: https://chromiumcodereview.appspot.com/9965137 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130666 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/webapp/host_table_entry.js')
-rw-r--r--remoting/webapp/host_table_entry.js29
1 files changed, 18 insertions, 11 deletions
diff --git a/remoting/webapp/host_table_entry.js b/remoting/webapp/host_table_entry.js
index 228a49b..789db2c 100644
--- a/remoting/webapp/host_table_entry.js
+++ b/remoting/webapp/host_table_entry.js
@@ -149,28 +149,36 @@ remoting.HostTableEntry.prototype.init = function(
'?mode=me2me&hostId=' + encodeURIComponent(host.hostId);
this.onConnectReference_ = function() { window.location.assign(hostUrl); };
- this.updateOnlineStatus();
+ this.updateStatus();
};
/**
- * Update the row to reflect the current on-line status of the host.
+ * Update the row to reflect the current status of the host (online/offline and
+ * clickable/unclickable).
*
+ * @param {boolean=} opt_forEdit True if the status is being updated in order
+ * to allow the host name to be edited.
* @return {void} Nothing.
*/
-remoting.HostTableEntry.prototype.updateOnlineStatus = function() {
- if (this.host.status == 'ONLINE') {
+remoting.HostTableEntry.prototype.updateStatus = function(opt_forEdit) {
+ var clickToConnect = this.host.status == 'ONLINE' && !opt_forEdit;
+ if (clickToConnect) {
this.tableRow.addEventListener('click', this.onConnectReference_, false);
this.tableRow.classList.add('clickable');
- this.tableRow.classList.add('host-online');
- this.tableRow.classList.remove('host-offline');
this.tableRow.title = chrome.i18n.getMessage(
/*i18n-content*/'TOOLTIP_CONNECT', this.host.hostName);
} else {
this.tableRow.removeEventListener('click', this.onConnectReference_, false);
this.tableRow.classList.remove('clickable');
+ this.tableRow.title = '';
+ }
+ var showOffline = this.host.status != 'ONLINE';
+ if (showOffline) {
this.tableRow.classList.remove('host-online');
this.tableRow.classList.add('host-offline');
- this.tableRow.title = '';
+ } else {
+ this.tableRow.classList.add('host-online');
+ this.tableRow.classList.remove('host-offline');
}
};
@@ -195,6 +203,7 @@ remoting.HostTableEntry.prototype.beginRename_ = function() {
/** @param {Event} event The keydown event. */
var onKeydown = function(event) { that.onKeydown_(event); }
editBox.addEventListener('keydown', onKeydown, false);
+ this.updateStatus(true);
};
/**
@@ -207,12 +216,10 @@ remoting.HostTableEntry.prototype.commitRename_ = function() {
if (editBox) {
if (this.host.hostName != editBox.value) {
this.host.hostName = editBox.value;
- if (this.host.status == 'ONLINE') {
- this.tableRow.title = chrome.i18n.getMessage(
- /*i18n-content*/'TOOLTIP_CONNECT', this.host.hostName);
- }
this.onRename_(this);
}
+ // Update the tool-top and event handler.
+ this.updateStatus();
this.removeEditBox_();
}
};