summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-02 17:14:52 +0000
committerjamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-02 17:14:52 +0000
commit35b423a8e761e5f7f94618ad6484933c3614a409 (patch)
treea1b1902438445fe2e7064ed116a8ba9629abf6d1
parenta77575d3bda80b4e1a7ef69411e4540269a77e39 (diff)
downloadchromium_src-35b423a8e761e5f7f94618ad6484933c3614a409.zip
chromium_src-35b423a8e761e5f7f94618ad6484933c3614a409.tar.gz
chromium_src-35b423a8e761e5f7f94618ad6484933c3614a409.tar.bz2
Improve host-list display in case of auth or network error.
There were a couple of underlying problems: 1. The user-visible string for NETWORK_FAILED was very host specific. I changed it to be more generic and added a new NAT_TRAVERSAL_DISABLED error for that case. Note that there may be non-NAT-related situations that would cause the same error condition, so it's not 100% accurate. I've also gotten rid of the NO_RESPONSE error, which was serving the same purpose as NETWORK_FAILED, but with less helpful language. 2. The cached host-list was being cleared in case of errors, so the web-app was unable to display the name of the local host. BUG=175241 Review URL: https://chromiumcodereview.appspot.com/12374053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185716 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--remoting/resources/remoting_strings.grd6
-rw-r--r--remoting/webapp/client_session.js2
-rw-r--r--remoting/webapp/error.js4
-rw-r--r--remoting/webapp/host_list.js41
-rw-r--r--remoting/webapp/session_connector.js2
5 files changed, 26 insertions, 29 deletions
diff --git a/remoting/resources/remoting_strings.grd b/remoting/resources/remoting_strings.grd
index 7bb12ed..04e6e73 100644
--- a/remoting/resources/remoting_strings.grd
+++ b/remoting/resources/remoting_strings.grd
@@ -330,11 +330,11 @@
<message desc="Error displayed if an invalid access code is entered." name="IDR_ERROR_INVALID_ACCESS_CODE">
The access code is invalid. Please try again.
</message>
- <message desc="Error displayed when the host is online, but we are unable to connect to it due to network configuration." name="IDR_ERROR_NETWORK_FAILURE">
+ <message desc="Error displayed when the host is online, but we are unable to connect to it due to network configuration." name="IDR_ERROR_P2P_FAILURE">
Unable to reach the host. This is probably due to the configuration of the network you are using.
</message>
- <message desc="Error displayed by the client if the server does not respond to a network request." name="IDR_ERROR_NO_RESPONSE">
- The server failed to respond to the network request.
+ <message desc="Error displayed when the host is online, but we are unable to connect to it due to network configuration." name="IDR_ERROR_NETWORK_FAILURE">
+ Could not connect to the network. Please check that your device is on-line.
</message>
<message desc="Error displayed when the service returns a 503 error. Such errors are usually temporary, and resolve themselves in about 30 seconds." name="IDR_ERROR_SERVICE_UNAVAILABLE">
The service is temporarily unavailable. Please try again later.
diff --git a/remoting/webapp/client_session.js b/remoting/webapp/client_session.js
index 35c4b03..89fcc82 100644
--- a/remoting/webapp/client_session.js
+++ b/remoting/webapp/client_session.js
@@ -423,7 +423,7 @@ remoting.ClientSession.prototype.getError = function() {
case remoting.ClientSession.ConnectionError.INCOMPATIBLE_PROTOCOL:
return remoting.Error.INCOMPATIBLE_PROTOCOL;
case remoting.ClientSession.ConnectionError.NETWORK_FAILURE:
- return remoting.Error.NETWORK_FAILURE;
+ return remoting.Error.P2P_FAILURE;
case remoting.ClientSession.ConnectionError.HOST_OVERLOAD:
return remoting.Error.HOST_OVERLOAD;
default:
diff --git a/remoting/webapp/error.js b/remoting/webapp/error.js
index ff8b529..a1e3ab3 100644
--- a/remoting/webapp/error.js
+++ b/remoting/webapp/error.js
@@ -11,7 +11,6 @@ var remoting = remoting || {};
* @enum {string} All error messages from messages.json
*/
remoting.Error = {
- NO_RESPONSE: /*i18n-content*/'ERROR_NO_RESPONSE',
INVALID_ACCESS_CODE: /*i18n-content*/'ERROR_INVALID_ACCESS_CODE',
MISSING_PLUGIN: /*i18n-content*/'ERROR_MISSING_PLUGIN',
AUTHENTICATION_FAILED: /*i18n-content*/'ERROR_AUTHENTICATION_FAILED',
@@ -23,5 +22,6 @@ remoting.Error = {
UNEXPECTED: /*i18n-content*/'ERROR_UNEXPECTED',
SERVICE_UNAVAILABLE: /*i18n-content*/'ERROR_SERVICE_UNAVAILABLE',
NOT_AUTHENTICATED: /*i18n-content*/'ERROR_NOT_AUTHENTICATED',
- INVALID_HOST_DOMAIN: /*i18n-content*/'ERROR_INVALID_HOST_DOMAIN'
+ INVALID_HOST_DOMAIN: /*i18n-content*/'ERROR_INVALID_HOST_DOMAIN',
+ P2P_FAILURE: /*i18n-content*/'ERROR_P2P_FAILURE'
};
diff --git a/remoting/webapp/host_list.js b/remoting/webapp/host_list.js
index 4bfdb4e..f5daa24 100644
--- a/remoting/webapp/host_list.js
+++ b/remoting/webapp/host_list.js
@@ -143,7 +143,6 @@ remoting.HostList.prototype.refresh = function(onDone) {
};
/** @param {remoting.Error} error */
var onError = function(error) {
- that.hosts_ = [];
that.lastError_ = error;
onDone(false);
};
@@ -161,7 +160,6 @@ remoting.HostList.prototype.refresh = function(onDone) {
* @private
*/
remoting.HostList.prototype.parseHostListResponse_ = function(onDone, xhr) {
- this.hosts_ = [];
this.lastError_ = '';
try {
if (xhr.status == 200) {
@@ -192,7 +190,7 @@ remoting.HostList.prototype.parseHostListResponse_ = function(onDone, xhr) {
// Some other error.
console.error('Bad status on host list query: ', xhr);
if (xhr.status == 0) {
- this.lastError_ = remoting.Error.NO_RESPONSE;
+ this.lastError_ = remoting.Error.NETWORK_FAILURE;
} else if (xhr.status == 401) {
this.lastError_ = remoting.Error.AUTHENTICATION_FAILED;
} else if (xhr.status == 502 || xhr.status == 503) {
@@ -224,23 +222,6 @@ remoting.HostList.prototype.display = function() {
this.table_.hidden = noHostsRegistered;
this.noHosts_.hidden = !noHostsRegistered;
- for (var i = 0; i < this.hosts_.length; ++i) {
- /** @type {remoting.Host} */
- var host = this.hosts_[i];
- // Validate the entry to make sure it has all the fields we expect and is
- // not the local host (which is displayed separately). NB: if the host has
- // never sent a heartbeat, then there will be no jabberId.
- if (host.hostName && host.hostId && host.status && host.publicKey &&
- (!this.localHost_ || host.hostId != this.localHost_.hostId)) {
- var hostTableEntry = new remoting.HostTableEntry(
- host, this.webappMajorVersion_,
- this.renameHost_.bind(this), this.deleteHost_.bind(this));
- hostTableEntry.createDom();
- this.hostTableEntries_[i] = hostTableEntry;
- this.table_.appendChild(hostTableEntry.tableRow);
- }
- }
-
if (this.lastError_ != '') {
l10n.localizeElementFromTag(this.errorMsg_, this.lastError_);
if (this.lastError_ == remoting.Error.AUTHENTICATION_FAILED) {
@@ -250,7 +231,25 @@ remoting.HostList.prototype.display = function() {
l10n.localizeElementFromTag(this.errorButton_,
/*i18n-content*/'RETRY');
}
+ } else {
+ for (var i = 0; i < this.hosts_.length; ++i) {
+ /** @type {remoting.Host} */
+ var host = this.hosts_[i];
+ // Validate the entry to make sure it has all the fields we expect and is
+ // not the local host (which is displayed separately). NB: if the host has
+ // never sent a heartbeat, then there will be no jabberId.
+ if (host.hostName && host.hostId && host.status && host.publicKey &&
+ (!this.localHost_ || host.hostId != this.localHost_.hostId)) {
+ var hostTableEntry = new remoting.HostTableEntry(
+ host, this.webappMajorVersion_,
+ this.renameHost_.bind(this), this.deleteHost_.bind(this));
+ hostTableEntry.createDom();
+ this.hostTableEntries_[i] = hostTableEntry;
+ this.table_.appendChild(hostTableEntry.tableRow);
+ }
+ }
}
+
this.errorMsg_.parentNode.hidden = (this.lastError_ == '');
var state = this.localHostState_;
@@ -441,8 +440,6 @@ remoting.HostList.prototype.onErrorClick_ = function() {
if (this.lastError_ == remoting.Error.AUTHENTICATION_FAILED) {
remoting.oauth2.doAuthRedirect();
} else {
- this.lastError_ = '';
- this.display();
this.refresh(remoting.updateLocalHostState);
}
};
diff --git a/remoting/webapp/session_connector.js b/remoting/webapp/session_connector.js
index 7816144..015e43e 100644
--- a/remoting/webapp/session_connector.js
+++ b/remoting/webapp/session_connector.js
@@ -392,7 +392,7 @@ remoting.SessionConnector.prototype.startAccessTokenRefreshTimer_ = function() {
remoting.SessionConnector.prototype.translateSupportHostsError =
function(error) {
switch (error) {
- case 0: return remoting.Error.NO_RESPONSE;
+ case 0: return remoting.Error.NETWORK_FAILURE;
case 404: return remoting.Error.INVALID_ACCESS_CODE;
case 502: // No break
case 503: return remoting.Error.SERVICE_UNAVAILABLE;