| Index: remoting/webapp/app_remoting/js/app_remoting_activity.js
|
| diff --git a/remoting/webapp/app_remoting/js/app_remoting_activity.js b/remoting/webapp/app_remoting/js/app_remoting_activity.js
|
| index fecd55d55bf37f7d98addd5fabc9d3f0172e745a..2e9ff73463c6515ea9a2d89871fbd874986deb7e 100644
|
| --- a/remoting/webapp/app_remoting/js/app_remoting_activity.js
|
| +++ b/remoting/webapp/app_remoting/js/app_remoting_activity.js
|
| @@ -140,12 +140,12 @@ remoting.AppRemotingActivity.prototype.onAppHostResponse_ =
|
| session.connect(host, credentialsProvider);
|
| });
|
| } else if (response && response.status == 'pending') {
|
| - this.onError(new remoting.Error(
|
| + this.onConnectionFailed(new remoting.Error(
|
| remoting.Error.Tag.SERVICE_UNAVAILABLE));
|
| }
|
| } else {
|
| console.error('Invalid "runApplication" response from server.');
|
| - this.onError(remoting.Error.fromHttpStatus(xhrResponse.status));
|
| + this.onConnectionFailed(remoting.Error.fromHttpStatus(xhrResponse.status));
|
| }
|
| };
|
|
|
| @@ -166,28 +166,36 @@ remoting.AppRemotingActivity.prototype.onConnected = function(connectionInfo) {
|
| }
|
| };
|
|
|
| -remoting.AppRemotingActivity.prototype.onDisconnected = function() {
|
| +/**
|
| + * @param {remoting.Error} error
|
| + */
|
| +remoting.AppRemotingActivity.prototype.onDisconnected = function(error) {
|
| + if (error.isNone()) {
|
| + chrome.app.window.current().close();
|
| + } else {
|
| + this.showErrorMessage_(error);
|
| + }
|
| this.cleanup_();
|
| - chrome.app.window.current().close();
|
| };
|
|
|
| /**
|
| * @param {!remoting.Error} error
|
| */
|
| remoting.AppRemotingActivity.prototype.onConnectionFailed = function(error) {
|
| - this.onError(error);
|
| + remoting.LoadingWindow.close();
|
| + this.showErrorMessage_(error);
|
| + this.cleanup_();
|
| };
|
|
|
| /**
|
| * @param {!remoting.Error} error The error to be localized and displayed.
|
| + * @private
|
| */
|
| -remoting.AppRemotingActivity.prototype.onError = function(error) {
|
| +remoting.AppRemotingActivity.prototype.showErrorMessage_ = function(error) {
|
| console.error('Connection failed: ' + error.toString());
|
| - remoting.LoadingWindow.close();
|
| remoting.MessageWindow.showErrorMessage(
|
| chrome.i18n.getMessage(/*i18n-content*/'CONNECTION_FAILED'),
|
| chrome.i18n.getMessage(error.getTag()));
|
| - this.cleanup_();
|
| };
|
|
|
| })();
|
|
|