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

Unified Diff: remoting/webapp/crd/js/desktop_remoting_activity.js

Issue 1101613003: [Webapp Refactor] Reliably cancels a connection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ImproveUnittest
Patch Set: Reviewer's feedback Created 5 years, 8 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/crd/js/desktop_remoting_activity.js
diff --git a/remoting/webapp/crd/js/desktop_remoting_activity.js b/remoting/webapp/crd/js/desktop_remoting_activity.js
index f9614032888818e4e30b5d30aa7c7eda9c5f6b4d..ef0d575904969962a2eb4396da1316dafd4250d0 100644
--- a/remoting/webapp/crd/js/desktop_remoting_activity.js
+++ b/remoting/webapp/crd/js/desktop_remoting_activity.js
@@ -30,6 +30,9 @@ remoting.DesktopRemotingActivity = function(parentActivity) {
remoting.app_capabilities());
/** @private {remoting.ClientSession} */
this.session_ = null;
+ /** @private {remoting.ConnectingDialog} */
+ this.connectingDialog_ =
+ new remoting.ConnectingDialog(parentActivity.stop.bind(parentActivity));
};
/**
@@ -48,7 +51,10 @@ remoting.DesktopRemotingActivity.prototype.start =
that.session_ = session;
session.logHostOfflineErrors(!opt_suppressOfflineError);
session.connect(host, credentialsProvider);
- });
+ }).catch(remoting.Error.handler(
+ function(/** !remoting.Error */ error) {
+ that.parentActivity_.onConnectionFailed(error);
+ }));
};
remoting.DesktopRemotingActivity.prototype.stop = function() {
@@ -63,6 +69,7 @@ remoting.DesktopRemotingActivity.prototype.stop = function() {
*/
remoting.DesktopRemotingActivity.prototype.onConnected =
function(connectionInfo) {
+ this.connectingDialog_.hide();
remoting.setMode(remoting.AppMode.IN_SESSION);
if (!base.isAppsV2()) {
remoting.toolbar.center();
@@ -90,7 +97,6 @@ remoting.DesktopRemotingActivity.prototype.onConnected =
remoting.DesktopRemotingActivity.prototype.onDisconnected = function() {
this.parentActivity_.onDisconnected();
- this.dispose();
};
/**
@@ -114,8 +120,6 @@ remoting.DesktopRemotingActivity.prototype.onError = function(error) {
}
this.parentActivity_.onError(error);
-
- this.dispose();
};
remoting.DesktopRemotingActivity.prototype.dispose = function() {
@@ -123,6 +127,7 @@ remoting.DesktopRemotingActivity.prototype.dispose = function() {
this.connectedView_ = null;
base.dispose(this.session_);
this.session_ = null;
+ this.connectingDialog_.hide();
};
/** @return {remoting.DesktopConnectedView} */
@@ -137,4 +142,9 @@ remoting.DesktopRemotingActivity.prototype.getSession = function() {
return this.session_;
};
+/** @return {remoting.ConnectingDialog} */
+remoting.DesktopRemotingActivity.prototype.getConnectingDialog = function() {
+ return this.connectingDialog_;
+};
+
})();

Powered by Google App Engine
This is Rietveld 408576698