Commit df66ed60 authored by jamiewalch@google.com's avatar jamiewalch@google.com

If an account with hosts registered is accessed on a machine on which those...

If an account with hosts registered is accessed on a machine on which those hosts are cached, then the host list should not display the "no hosts" icon while the host list is being refreshed. This CL fixes a bug related to the asynchronous nature of getting the local host id for the purpose of filtering it from the host list, which caused the cached host list never to be displayed.

Note that if the account has hosts registered, but is accessed from a computer with no cache, then the "no hosts" icon will still flash briefly (although it will generally be hidden behind the infographic).

BUG=135288
TEST=Manual

Review URL: https://chromiumcodereview.appspot.com/10736020

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146200 0039d316-1c4b-4281-b951-d872f2087c98
parent 33e3f1e8
...@@ -116,11 +116,10 @@ remoting.HostList.prototype.refresh = function(onDone) { ...@@ -116,11 +116,10 @@ remoting.HostList.prototype.refresh = function(onDone) {
}; };
/** @param {remoting.Error} error */ /** @param {remoting.Error} error */
var onError = function(error) { var onError = function(error) {
that.hosts_ = [];
that.lastError_ = error; that.lastError_ = error;
onDone(false); onDone(false);
}; };
this.hosts_ = [];
this.lastError_ = '';
remoting.oauth2.callWithToken(getHosts, onError); remoting.oauth2.callWithToken(getHosts, onError);
}; };
...@@ -135,6 +134,8 @@ remoting.HostList.prototype.refresh = function(onDone) { ...@@ -135,6 +134,8 @@ remoting.HostList.prototype.refresh = function(onDone) {
* @private * @private
*/ */
remoting.HostList.prototype.parseHostListResponse_ = function(onDone, xhr) { remoting.HostList.prototype.parseHostListResponse_ = function(onDone, xhr) {
this.hosts_ = [];
this.lastError_ = '';
try { try {
if (xhr.status == 200) { if (xhr.status == 200) {
var response = var response =
...@@ -155,10 +156,9 @@ remoting.HostList.prototype.parseHostListResponse_ = function(onDone, xhr) { ...@@ -155,10 +156,9 @@ remoting.HostList.prototype.parseHostListResponse_ = function(onDone, xhr) {
return 0; return 0;
}; };
this.hosts_ = /** @type {Array} */ this.hosts_.sort(cmp); this.hosts_ = /** @type {Array} */ this.hosts_.sort(cmp);
} else {
this.hosts_ = [];
} }
} else { } else {
this.lastError_ = remoting.Error.UNEXPECTED;
console.error('Invalid "hosts" response from server.'); console.error('Invalid "hosts" response from server.');
} }
} else { } else {
......
...@@ -93,6 +93,7 @@ remoting.initDaemonUi = function () { ...@@ -93,6 +93,7 @@ remoting.initDaemonUi = function () {
remoting.setMode(getAppStartupMode_()); remoting.setMode(getAppStartupMode_());
remoting.hostSetupDialog = remoting.hostSetupDialog =
new remoting.HostSetupDialog(remoting.hostController); new remoting.HostSetupDialog(remoting.hostController);
// Display the cached host list, then asynchronously update and re-display it.
remoting.extractThisHostAndDisplay(true); remoting.extractThisHostAndDisplay(true);
remoting.hostList.refresh(remoting.extractThisHostAndDisplay); remoting.hostList.refresh(remoting.extractThisHostAndDisplay);
}; };
......
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