diff options
author | jamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-26 08:47:45 +0000 |
---|---|---|
committer | jamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-26 08:47:45 +0000 |
commit | 3bbc9c037fc47d572770db4bda5c78a8a9006893 (patch) | |
tree | b8e20b7ebbfc4aa603d6e2ef60bc1580b7cf286f /remoting/webapp/remoting.js | |
parent | fd720d86dddbaaff1f940d0796c914e5fe7f7200 (diff) | |
download | chromium_src-3bbc9c037fc47d572770db4bda5c78a8a9006893.zip chromium_src-3bbc9c037fc47d572770db4bda5c78a8a9006893.tar.gz chromium_src-3bbc9c037fc47d572770db4bda5c78a8a9006893.tar.bz2 |
Refactor getLocalHostStateAndId to help with native messaging implementation.
Also, get rid of the cache of the local host id from HostController. It's only
used to unregister the host, and IMO the code is cleaner if it's re-fetched as
needed in this case. The overhead of doing so should be minimal.
BUG=173509
Review URL: https://chromiumcodereview.appspot.com/12902047
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190603 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/webapp/remoting.js')
-rw-r--r-- | remoting/webapp/remoting.js | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/remoting/webapp/remoting.js b/remoting/webapp/remoting.js index 931d0f7..c487fa1 100644 --- a/remoting/webapp/remoting.js +++ b/remoting/webapp/remoting.js @@ -147,14 +147,22 @@ remoting.initHomeScreenUi = function() { */ remoting.updateLocalHostState = function() { /** + * @param {string?} hostId Host id. + */ + var onHostId = function(hostId) { + remoting.hostController.getLocalHostState(onHostState.bind(null, hostId)); + }; + + /** + * @param {string?} hostId Host id. * @param {remoting.HostController.State} state Host state. - * @param {string?} localHostId */ - var onHostState = function(state, localHostId) { - remoting.hostList.setLocalHostStateAndId(state, localHostId); + var onHostState = function(hostId, state) { + remoting.hostList.setLocalHostStateAndId(state, hostId); remoting.hostList.display(); }; - remoting.hostController.getLocalHostStateAndId(onHostState); + + remoting.hostController.getLocalHostId(onHostId); }; /** |