Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1941)

Unified Diff: remoting/webapp/host_controller.js

Issue 10081027: Don't register more than one 'connect' event handler per HostTableEntry. Don't create more than one… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed JSCompile error. Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | remoting/webapp/host_table_entry.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/host_controller.js
diff --git a/remoting/webapp/host_controller.js b/remoting/webapp/host_controller.js
index 2b41096845b2d3c9ff99acc73ba7580b6f33a12c..e1395755890cbcbee0a8845f6109d26fad68064e 100644
--- a/remoting/webapp/host_controller.js
+++ b/remoting/webapp/host_controller.js
@@ -279,13 +279,21 @@ remoting.HostController.prototype.setHost = function(host) {
remoting.hostList.renameHost(host);
that.setTooltips();
};
- /** @type {remoting.HostTableEntry} @private */
- this.hostTableEntry_ = new remoting.HostTableEntry();
- this.hostTableEntry_.init(host,
- document.getElementById('this-host-connect'),
- document.getElementById('this-host-name'),
- document.getElementById('this-host-rename'),
- renameHost);
+ if (!this.hostTableEntry_) {
+ /** @type {remoting.HostTableEntry} @private */
+ this.hostTableEntry_ = new remoting.HostTableEntry();
+ this.hostTableEntry_.init(host,
+ document.getElementById('this-host-connect'),
+ document.getElementById('this-host-name'),
+ document.getElementById('this-host-rename'),
+ renameHost);
+ } else {
+ // TODO(jamiewalch): This is hack to prevent multiple click handlers being
+ // registered for the same DOM elements if this method is called more than
+ // once. A better solution would be to let HostTable create the daemon row
+ // like it creates the rows for non-local hosts.
+ this.hostTableEntry_.host = host;
+ }
} else {
this.hostTableEntry_ = null;
}
« no previous file with comments | « no previous file | remoting/webapp/host_table_entry.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698