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 19ec51208f6b249e4b49e3cb134b428b1ed21a2b..2697bbbd2512cffae8d31da131cca92395e761fe 100644 |
--- a/remoting/webapp/app_remoting/js/app_remoting_activity.js |
+++ b/remoting/webapp/app_remoting/js/app_remoting_activity.js |
@@ -180,9 +180,8 @@ remoting.AppRemotingActivity.prototype.onDisconnected = function(error) { |
if (error.isNone()) { |
chrome.app.window.current().close(); |
} else { |
- this.showErrorMessage_(error); |
+ this.onConnectionDropped_(); |
} |
- this.cleanup_(); |
}; |
/** |
@@ -194,6 +193,32 @@ remoting.AppRemotingActivity.prototype.onConnectionFailed = function(error) { |
this.cleanup_(); |
}; |
+/** @private */ |
+remoting.AppRemotingActivity.prototype.onConnectionDropped_ = function() { |
+ var rootElement = /** @type {HTMLDialogElement} */ ( |
+ document.getElementById('connection-dropped-dialog')); |
+ |
+ var dialog = new remoting.Html5ModalDialog({ |
+ dialog: rootElement, |
+ primaryButton: rootElement.querySelector('.restart-button'), |
+ secondaryButton: rootElement.querySelector('.close-button'), |
+ closeOnEscape: false |
+ }); |
+ |
+ var that = this; |
+ dialog.show().then(function(/** remoting.MessageDialog.Result */ result) { |
+ if (result === remoting.MessageDialog.Result.PRIMARY) { |
+ // Hide the windows of the remote application with setDesktopRects([]) |
+ // before tearing down the plugin. |
+ remoting.windowShape.setDesktopRects([]); |
+ that.cleanup_(); |
+ that.start(); |
+ } else { |
+ chrome.app.window.current().close(); |
+ } |
+ }); |
+}; |
+ |
/** |
* @param {!remoting.Error} error The error to be localized and displayed. |
* @private |