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

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: 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..0ac60af30d30ea5dcff8a45c5eaa929c7d0ac341 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,28 @@ remoting.AppRemotingActivity.prototype.onConnectionFailed = function(error) {
this.cleanup_();
};
+/** @private */
+remoting.AppRemotingActivity.prototype.onConnectionDropped_ = function() {
Jamie 2015/05/20 02:20:37 I think there's value in passing the error into he
kelvinp 2015/05/20 18:13:00 The error is already logged in the earlier stack (
+ var rootElement = /** @type {HTMLDialogElement} */ (
+ document.getElementById('connection-dropped-dialog'));
+ var dialog = new remoting.Html5ModalDialog(
+ rootElement, rootElement.querySelector('.restart-button'),
+ rootElement.querySelector('.close-button'));
+ var Result = remoting.MessageDialog.Result;
Jamie 2015/05/20 02:20:37 I'm surprised that this assignment works as far as
kelvinp 2015/05/20 18:12:59 Done.
+ var that = this;
+
+ dialog.show().then(function(/** Result */ result) {
+ if (result === Result.PRIMARY) {
+ // Hide the desktop window before tearing down the plugin.
Jamie 2015/05/20 02:20:37 This comment doesn't seem to be accurate.
kelvinp 2015/05/20 18:13:00 Maybe I need to phrase it better. By calling setD
+ 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

Powered by Google App Engine
This is Rietveld 408576698