Chromium Code Reviews| Index: remoting/webapp/app_remoting/js/app_remoting.js |
| diff --git a/remoting/webapp/app_remoting/js/app_remoting.js b/remoting/webapp/app_remoting/js/app_remoting.js |
| index f1f35cb282438f6d6b908cd7ca7252ccd62d776c..ac4a574f02e54b27fd312553452b5a6322ac99de 100644 |
| --- a/remoting/webapp/app_remoting/js/app_remoting.js |
| +++ b/remoting/webapp/app_remoting/js/app_remoting.js |
| @@ -104,11 +104,11 @@ remoting.AppRemoting.prototype.start = function(connector, token) { |
| /** @type {remoting.AppRemoting} */ |
| var that = this; |
| - /** @param {XMLHttpRequest} xhr */ |
| - var parseAppHostResponse = function(xhr) { |
| - if (xhr.status == 200) { |
| + /** @param {remoting.Xhr.Response} xhrResponse */ |
| + var parseAppHostResponse = function(xhrResponse) { |
| + if (xhrResponse.status == 200) { |
| var response = /** @type {remoting.AppRemoting.AppHostResponse} */ |
| - (base.jsonParseSafe(xhr.responseText)); |
| + (base.jsonParseSafe(xhrResponse.textContent)); |
| if (response && |
| response.status && |
| response.status == 'done' && |
| @@ -156,16 +156,16 @@ remoting.AppRemoting.prototype.start = function(connector, token) { |
| // TODO(garykac) Start using remoting.Error.fromHttpStatus once it has |
| // been updated to properly report 'unknown' errors (rather than |
| // reporting them as AUTHENTICATION_FAILED). |
| - if (xhr.status == 0) { |
| + if (xhrResponse.status == 0) { |
| that.handleError(new remoting.Error( |
| remoting.Error.Tag.NETWORK_FAILURE)); |
| - } else if (xhr.status == 401) { |
| + } else if (xhrResponse.status == 401) { |
| that.handleError(new remoting.Error( |
| remoting.Error.Tag.AUTHENTICATION_FAILED)); |
| - } else if (xhr.status == 403) { |
| + } else if (xhrResponse.status == 403) { |
| that.handleError(new remoting.Error( |
| remoting.Error.Tag.APP_NOT_AUTHORIZED)); |
| - } else if (xhr.status == 502 || xhr.status == 503) { |
| + } else if (xhrResponse.status == 502 || xhrResponse.status == 503) { |
| that.handleError(new remoting.Error( |
| remoting.Error.Tag.SERVICE_UNAVAILABLE)); |
| } else { |
| @@ -174,12 +174,11 @@ remoting.AppRemoting.prototype.start = function(connector, token) { |
| } |
| }; |
| - remoting.xhr.start({ |
| + new remoting.Xhr({ |
| method: 'POST', |
| url: that.runApplicationUrl(), |
| - onDone: parseAppHostResponse, |
| oauthToken: token |
| - }); |
| + }).start().then(parseAppHostResponse); |
| }; |
| /** |
| @@ -197,7 +196,7 @@ remoting.AppRemoting.prototype.signInFailed = function(error) { |
| */ |
| remoting.AppRemoting.prototype.getApplicationName = function() { |
| var manifest = chrome.runtime.getManifest(); |
| - return manifest.name; |
| + // XXX return manifest.name; |
|
kelvinp
2015/03/17 01:32:46
what does //XXX stands for?
John Williams
2015/03/17 17:39:38
"Don't commit this." Oops. I was testing to see if
kelvinp
2015/03/17 22:06:20
Acknowledged.
|
| }; |
| /** @return {string} */ |
| @@ -341,7 +340,7 @@ remoting.AppRemoting.prototype.handleError = function(error) { |
| remoting.LoadingWindow.close(); |
| remoting.MessageWindow.showErrorMessage( |
| chrome.i18n.getMessage(/*i18n-content*/'CONNECTION_FAILED'), |
| - chrome.i18n.getMessage(/** @type {string} */ (error.tag))); |
| + chrome.i18n.getMessage(error.getTag())); |
| }; |
| /** |