| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * This class implements the functionality that is specific to application | 7 * This class implements the functionality that is specific to application |
| 8 * remoting ("AppRemoting" or AR). | 8 * remoting ("AppRemoting" or AR). |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 onThirdPartyTokenFetched(host['authorizationCode'], | 158 onThirdPartyTokenFetched(host['authorizationCode'], |
| 159 host['sharedSecret']); | 159 host['sharedSecret']); |
| 160 }; | 160 }; |
| 161 | 161 |
| 162 connector.connectMe2App(host, fetchThirdPartyToken); | 162 connector.connectMe2App(host, fetchThirdPartyToken); |
| 163 } else if (response && response.status == 'pending') { | 163 } else if (response && response.status == 'pending') { |
| 164 that.handleError(remoting.Error.SERVICE_UNAVAILABLE); | 164 that.handleError(remoting.Error.SERVICE_UNAVAILABLE); |
| 165 } | 165 } |
| 166 } else { | 166 } else { |
| 167 console.error('Invalid "runApplication" response from server.'); | 167 console.error('Invalid "runApplication" response from server.'); |
| 168 // TODO(garykac) Start using remoting.Error.fromHttpError once it has | 168 // TODO(garykac) Start using remoting.Error.fromHttpStatus once it has |
| 169 // been updated to properly report 'unknown' errors (rather than | 169 // been updated to properly report 'unknown' errors (rather than |
| 170 // reporting them as AUTHENTICATION_FAILED). | 170 // reporting them as AUTHENTICATION_FAILED). |
| 171 if (xhr.status == 0) { | 171 if (xhr.status == 0) { |
| 172 that.handleError(remoting.Error.NETWORK_FAILURE); | 172 that.handleError(remoting.Error.NETWORK_FAILURE); |
| 173 } else if (xhr.status == 401) { | 173 } else if (xhr.status == 401) { |
| 174 that.handleError(remoting.Error.AUTHENTICATION_FAILED); | 174 that.handleError(remoting.Error.AUTHENTICATION_FAILED); |
| 175 } else if (xhr.status == 403) { | 175 } else if (xhr.status == 403) { |
| 176 that.handleError(remoting.Error.NOT_AUTHORIZED); | 176 that.handleError(remoting.Error.NOT_AUTHORIZED); |
| 177 } else if (xhr.status == 502 || xhr.status == 503) { | 177 } else if (xhr.status == 502 || xhr.status == 503) { |
| 178 that.handleError(remoting.Error.SERVICE_UNAVAILABLE); | 178 that.handleError(remoting.Error.SERVICE_UNAVAILABLE); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 remoting.MessageWindow.showErrorMessage( | 345 remoting.MessageWindow.showErrorMessage( |
| 346 chrome.i18n.getMessage(/**i18n-content*/'CONNECTION_FAILED'), | 346 chrome.i18n.getMessage(/**i18n-content*/'CONNECTION_FAILED'), |
| 347 chrome.i18n.getMessage(/** @type {string} */ (errorTag))); | 347 chrome.i18n.getMessage(/** @type {string} */ (errorTag))); |
| 348 }; | 348 }; |
| 349 | 349 |
| 350 /** @return {string} */ | 350 /** @return {string} */ |
| 351 remoting.AppRemoting.prototype.runApplicationUrl = function() { | 351 remoting.AppRemoting.prototype.runApplicationUrl = function() { |
| 352 return remoting.settings.APP_REMOTING_API_BASE_URL + '/applications/' + | 352 return remoting.settings.APP_REMOTING_API_BASE_URL + '/applications/' + |
| 353 remoting.settings.getAppRemotingApplicationId() + '/run'; | 353 remoting.settings.getAppRemotingApplicationId() + '/run'; |
| 354 }; | 354 }; |
| OLD | NEW |