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

Unified Diff: remoting/webapp/crd/js/smart_reconnector.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/smart_reconnector.js
diff --git a/remoting/webapp/crd/js/smart_reconnector.js b/remoting/webapp/crd/js/smart_reconnector.js
index 3ad4d6f4ab48f7110a3842472bffa3e121907bea..84397fd0ff21de62607e0f36d38d9910f4a401ee 100644
--- a/remoting/webapp/crd/js/smart_reconnector.js
+++ b/remoting/webapp/crd/js/smart_reconnector.js
@@ -21,6 +21,7 @@ var remoting = remoting || {};
/**
* @constructor
+ * @param {remoting.ConnectingDialog} connectingDialog
* @param {function()} reconnectCallback
* @param {function()} disconnectCallback
* @param {remoting.ClientSession} clientSession This represents the current
@@ -28,8 +29,8 @@ var remoting = remoting || {};
* connection state.
* @implements {base.Disposable}
*/
-remoting.SmartReconnector =
- function(reconnectCallback, disconnectCallback, clientSession) {
+remoting.SmartReconnector = function(connectingDialog, reconnectCallback,
+ disconnectCallback, clientSession) {
/** @private */
this.reconnectCallback_ = reconnectCallback;
@@ -47,6 +48,9 @@ remoting.SmartReconnector =
*/
this.pending_ = null;
+ /** @private */
+ this.connectingDialog_ = connectingDialog;
+
var Events = remoting.ClientSession.Events;
/** @private */
this.eventHooks_ = new base.Disposables(
@@ -68,13 +72,12 @@ var CONNECTION_TIMEOUT_MS = 10000;
remoting.SmartReconnector.prototype.reconnect_ = function() {
this.cancelPending_();
this.disconnectCallback_();
- remoting.setMode(remoting.AppMode.CLIENT_CONNECTING);
this.reconnectCallback_();
};
remoting.SmartReconnector.prototype.reconnectAsync_ = function() {
this.cancelPending_();
- remoting.setMode(remoting.AppMode.CLIENT_CONNECTING);
+ this.connectingDialog_.show();
this.pending_ =
new base.OneShotTimer(this.reconnect_.bind(this), RECONNECT_DELAY_MS);
};
« remoting/webapp/crd/js/me2me_activity.js ('K') | « remoting/webapp/crd/js/me2me_activity.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698