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

Unified Diff: remoting/webapp/app_remoting/js/app_remoting_activity.js

Issue 1146833002: [AppRemoting] Implement ConnectionDroppedDialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: WindowShape fixes + reviewer's feedback Created 5 years, 7 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/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
« no previous file with comments | « remoting/webapp/app_remoting/js/app_connected_view.js ('k') | remoting/webapp/app_remoting/js/context_menu_chrome.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698