Index: remoting/webapp/crd/js/client_session.js |
diff --git a/remoting/webapp/crd/js/client_session.js b/remoting/webapp/crd/js/client_session.js |
index 81a6ae100184910fee13f67c3442889cec799618..fe4511fc28952fcbeef2d6c11b394369f7de6f43 100644 |
--- a/remoting/webapp/crd/js/client_session.js |
+++ b/remoting/webapp/crd/js/client_session.js |
@@ -590,13 +590,7 @@ remoting.ClientSession.prototype.removePlugin = function() { |
function() { |
remoting.fullscreen.removeListener(listener); |
}); |
- if (remoting.windowFrame) { |
- remoting.windowFrame.setClientSession(null); |
- } else { |
- remoting.toolbar.setClientSession(null); |
- } |
- remoting.optionsMenu.setClientSession(null); |
- document.body.classList.remove('connected'); |
+ this.updateClientSessionUi_(null); |
// Remove mediasource-rendering class from the container - this will also |
// hide the <video> element. |
@@ -608,6 +602,29 @@ remoting.ClientSession.prototype.removePlugin = function() { |
}; |
/** |
+ * @param {remoting.ClientSession} clientSession The active session, or null if |
+ * there is no connection. |
+ */ |
+remoting.ClientSession.prototype.updateClientSessionUi_ = function( |
+ clientSession) { |
+ if (remoting.windowFrame) { |
+ remoting.windowFrame.setClientSession(clientSession); |
+ } |
+ if (remoting.toolbar) { |
+ remoting.toolbar.setClientSession(clientSession); |
+ } |
+ if (remoting.optionsMenu) { |
+ remoting.optionsMenu.setClientSession(clientSession); |
+ } |
+ |
+ if (clientSession == null) { |
+ document.body.classList.remove('connected'); |
+ } else { |
+ document.body.classList.add('connected'); |
+ } |
+} |
+ |
+/** |
* Disconnect the current session with a particular |error|. The session will |
* raise a |stateChanged| event in response to it. The caller should then call |
* |cleanup| to remove and destroy the <embed> element. |
@@ -955,14 +972,7 @@ remoting.ClientSession.prototype.onConnectionStatusUpdate_ = |
} |
// Activate full-screen related UX. |
remoting.fullscreen.addListener(this.callOnFullScreenChanged_); |
- if (remoting.windowFrame) { |
- remoting.windowFrame.setClientSession(this); |
- } else { |
- remoting.toolbar.setClientSession(this); |
- } |
- remoting.optionsMenu.setClientSession(this); |
- document.body.classList.add('connected'); |
- |
+ this.updateClientSessionUi_(this); |
this.container_.addEventListener('mousemove', |
this.updateMouseCursorPosition_, |
true); |