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

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

Issue 1093373005: [Webapp Refactor] Cleans up the ClientSession.EventHandler interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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..a1aa22496d79362405c290715100ddc0f976daab 100644
--- a/remoting/webapp/crd/js/smart_reconnector.js
+++ b/remoting/webapp/crd/js/smart_reconnector.js
@@ -49,11 +49,9 @@ remoting.SmartReconnector =
var Events = remoting.ClientSession.Events;
/** @private */
- this.eventHooks_ = new base.Disposables(
- new base.EventHook(clientSession, Events.stateChanged,
- this.stateChanged_.bind(this)),
+ this.eventHook_ =
new base.EventHook(clientSession, Events.videoChannelStateChanged,
- this.videoChannelStateChanged_.bind(this)));
+ this.videoChannelStateChanged_.bind(this));
};
// The online event only means the network adapter is enabled, but
@@ -80,18 +78,15 @@ remoting.SmartReconnector.prototype.reconnectAsync_ = function() {
};
/**
- * @param {remoting.ClientSession.StateEvent=} event
+ * @param {!remoting.Error} reason
*/
-remoting.SmartReconnector.prototype.stateChanged_ = function(event) {
- var State = remoting.ClientSession.State;
- if (event.previous === State.CONNECTED && event.current === State.FAILED) {
- this.cancelPending_();
- if (navigator.onLine) {
- this.reconnect_();
- } else {
- this.pending_ = new base.DomEventHook(
- window, 'online', this.reconnectAsync_.bind(this), false);
- }
+remoting.SmartReconnector.prototype.onConnectionDropped = function(reason) {
+ this.cancelPending_();
+ if (navigator.onLine) {
+ this.reconnect_();
+ } else {
+ this.pending_ = new base.DomEventHook(
+ window, 'online', this.reconnectAsync_.bind(this), false);
}
};
@@ -121,8 +116,8 @@ remoting.SmartReconnector.prototype.cancelPending_ = function() {
remoting.SmartReconnector.prototype.dispose = function() {
this.cancelPending_();
- base.dispose(this.eventHooks_);
- this.eventHooks_ = null;
+ base.dispose(this.eventHook_);
+ this.eventHook_ = null;
};
})();
« remoting/webapp/crd/js/client_session.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