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

Unified Diff: remoting/webapp/crd/js/host_list.js

Issue 955283002: Converted remoting.Error from an enum to a class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Smaller diff. Created 5 years, 10 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
Index: remoting/webapp/crd/js/host_list.js
diff --git a/remoting/webapp/crd/js/host_list.js b/remoting/webapp/crd/js/host_list.js
index 4221115d3e33e8c1cb040800b29e43b435eddef6..2748a386260e59cbe5074416587a0410aeb3f7ee 100644
--- a/remoting/webapp/crd/js/host_list.js
+++ b/remoting/webapp/crd/js/host_list.js
@@ -67,10 +67,10 @@ remoting.HostList = function(table, noHosts, errorMsg, errorButton,
*/
this.hosts_ = [];
/**
- * @type {string}
+ * @type {!remoting.Error}
* @private
*/
- this.lastError_ = '';
+ this.lastError_ = remoting.Error.NONE;
/**
* @type {remoting.Host?}
* @private
@@ -167,7 +167,7 @@ remoting.HostList.prototype.refresh = function(onDone) {
this.loadingIndicator_.classList.add('loading');
/** @type {remoting.HostList} */
var that = this;
- /** @param {remoting.Error} error */
+ /** @param {!remoting.Error} error */
var onError = function(error) {
that.lastError_ = error;
onDone(false);
@@ -187,12 +187,12 @@ remoting.HostList.prototype.refresh = function(onDone) {
* @private
*/
remoting.HostList.prototype.onHostListResponse_ = function(onDone, hosts) {
- this.lastError_ = '';
+ this.lastError_ = remoting.Error.NONE;
this.hosts_ = hosts;
this.sortHosts_();
this.save_();
this.loadingIndicator_.classList.remove('loading');
- onDone(this.lastError_ == '');
+ onDone(this.lastError_.tag == remoting.Error.Tag.NONE);
Jamie 2015/02/26 18:57:42 Not strictly related to your changes, but since ne
John Williams 2015/02/27 21:42:11 Done.
};
/**
@@ -242,8 +242,8 @@ remoting.HostList.prototype.display = function() {
this.noHosts_.hidden = !noHostsRegistered;
if (this.lastError_ != '') {
- l10n.localizeElementFromTag(this.errorMsg_, this.lastError_);
- if (this.lastError_ == remoting.Error.AUTHENTICATION_FAILED) {
+ l10n.localizeElementFromTag(this.errorMsg_, this.lastError_.tag);
+ if (this.lastError_.tag == remoting.Error.Tag.AUTHENTICATION_FAILED) {
l10n.localizeElementFromTag(this.errorButton_,
/*i18n-content*/'SIGN_IN_BUTTON');
} else {
@@ -481,7 +481,7 @@ remoting.HostList.prototype.onLocalHostStarted = function(
* @private
*/
remoting.HostList.prototype.onErrorClick_ = function() {
- if (this.lastError_ == remoting.Error.AUTHENTICATION_FAILED) {
+ if (this.lastError_.tag == remoting.Error.Tag.AUTHENTICATION_FAILED) {
remoting.handleAuthFailureAndRelaunch();
} else {
this.refresh(remoting.updateLocalHostState);

Powered by Google App Engine
This is Rietveld 408576698