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

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

Issue 767013007: [Chromoting] Share code that updates the UI when clientSession changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698