Index: remoting/webapp/client_session.js |
diff --git a/remoting/webapp/client_session.js b/remoting/webapp/client_session.js |
index 08ad854079c63346a0f40e4dad35cf2adfd1f6cd..536b02f394b118a0bcd2fe90b3ed70ff7081d758 100644 |
--- a/remoting/webapp/client_session.js |
+++ b/remoting/webapp/client_session.js |
@@ -23,6 +23,7 @@ |
var remoting = remoting || {}; |
/** |
+ * @param {string} hostDisplayName A human-readable name for the host. |
* @param {string} accessCode The IT2Me access code. Blank for Me2Me. |
* @param {function(boolean, function(string): void): void} fetchPin |
* Called by Me2Me connections when a PIN needs to be obtained |
@@ -46,8 +47,8 @@ var remoting = remoting || {}; |
* @constructor |
* @extends {base.EventSource} |
*/ |
-remoting.ClientSession = function(accessCode, fetchPin, fetchThirdPartyToken, |
- authenticationMethods, |
+remoting.ClientSession = function(hostDisplayName, accessCode, fetchPin, |
+ fetchThirdPartyToken, authenticationMethods, |
hostId, hostJid, hostPublicKey, mode, |
clientPairingId, clientPairedSecret) { |
/** @private */ |
@@ -57,6 +58,8 @@ remoting.ClientSession = function(accessCode, fetchPin, fetchThirdPartyToken, |
this.error_ = remoting.Error.NONE; |
/** @private */ |
+ this.hostDisplayName_ = hostDisplayName; |
+ /** @private */ |
this.hostJid_ = hostJid; |
/** @private */ |
this.hostPublicKey_ = hostPublicKey; |
@@ -109,8 +112,6 @@ remoting.ClientSession = function(accessCode, fetchPin, fetchThirdPartyToken, |
/** @private */ |
this.callPluginGotFocus_ = this.pluginGotFocus_.bind(this); |
/** @private */ |
- this.callSetScreenMode_ = this.onSetScreenMode_.bind(this); |
- /** @private */ |
this.callToggleFullScreen_ = remoting.fullscreen.toggle.bind( |
remoting.fullscreen); |
/** @private */ |
@@ -144,12 +145,8 @@ remoting.ClientSession = function(accessCode, fetchPin, fetchThirdPartyToken, |
this.resizeToClientButton_.hidden = true; |
} else { |
this.resizeToClientButton_.hidden = false; |
- this.resizeToClientButton_.addEventListener( |
- 'click', this.callSetScreenMode_, false); |
} |
- this.shrinkToFitButton_.addEventListener( |
- 'click', this.callSetScreenMode_, false); |
this.fullScreenButton_.addEventListener( |
'click', this.callToggleFullScreen_, false); |
this.defineEvents(Object.keys(remoting.ClientSession.Events)); |
@@ -164,6 +161,15 @@ remoting.ClientSession.Events = { |
}; |
/** |
+ * Get host display name. |
+ * |
+ * @return {string} |
+ */ |
+remoting.ClientSession.prototype.getHostDisplayName = function() { |
+ return this.hostDisplayName_; |
+}; |
+ |
+/** |
* Called when the window or desktop size or the scaling settings change, |
* to set the scroll-bar visibility. |
* |
@@ -202,6 +208,20 @@ remoting.ClientSession.prototype.updateScrollbarVisibility = function() { |
} |
}; |
+/** |
+ * @return {boolean} True if shrink-to-fit is enabled; false otherwise. |
+ */ |
+remoting.ClientSession.prototype.getShrinkToFit = function() { |
+ return this.shrinkToFit_; |
+}; |
+ |
+/** |
+ * @return {boolean} True if resize-to-client is enabled; false otherwise. |
+ */ |
+remoting.ClientSession.prototype.getResizeToClient = function() { |
+ return this.resizeToClient_; |
+}; |
+ |
// Note that the positive values in both of these enums are copied directly |
// from chromoting_scriptable_object.h and must be kept in sync. The negative |
// values represent state transitions that occur within the web-app that have |
@@ -563,10 +583,6 @@ remoting.ClientSession.prototype.removePlugin = function() { |
} |
// Delete event handlers that aren't relevent when not connected. |
- this.resizeToClientButton_.removeEventListener( |
- 'click', this.callSetScreenMode_, false); |
- this.shrinkToFitButton_.removeEventListener( |
- 'click', this.callSetScreenMode_, false); |
this.fullScreenButton_.removeEventListener( |
'click', this.callToggleFullScreen_, false); |
@@ -581,6 +597,7 @@ remoting.ClientSession.prototype.removePlugin = function() { |
if (remoting.windowFrame) { |
remoting.windowFrame.setConnected(false); |
} |
+ remoting.toolbar.setClientSession(null); |
// Remove mediasource-rendering class from video-contained - this will also |
// hide the <video> element. |
@@ -676,6 +693,7 @@ remoting.ClientSession.prototype.sendKeyCombination_ = function(keys) { |
* @return {void} Nothing. |
*/ |
remoting.ClientSession.prototype.sendCtrlAltDel = function() { |
+ console.log('Sending Ctrl-Alt-Del.'); |
this.sendKeyCombination_([0x0700e0, 0x0700e2, 0x07004c]); |
} |
@@ -685,6 +703,7 @@ remoting.ClientSession.prototype.sendCtrlAltDel = function() { |
* @return {void} Nothing. |
*/ |
remoting.ClientSession.prototype.sendPrintScreen = function() { |
+ console.log('Sending Print Screen.'); |
this.sendKeyCombination_([0x070046]); |
} |
@@ -747,26 +766,6 @@ remoting.ClientSession.prototype.applyRemapKeys_ = function(apply) { |
} |
/** |
- * Callback for the two "screen mode" related menu items: Resize desktop to |
- * fit and Shrink to fit. |
- * |
- * @param {Event} event The click event indicating which mode was selected. |
- * @return {void} Nothing. |
- * @private |
- */ |
-remoting.ClientSession.prototype.onSetScreenMode_ = function(event) { |
- var shrinkToFit = this.shrinkToFit_; |
- var resizeToClient = this.resizeToClient_; |
- if (event.target == this.shrinkToFitButton_) { |
- shrinkToFit = !shrinkToFit; |
- } |
- if (event.target == this.resizeToClientButton_) { |
- resizeToClient = !resizeToClient; |
- } |
- this.setScreenMode_(shrinkToFit, resizeToClient); |
-}; |
- |
-/** |
* Set the shrink-to-fit and resize-to-client flags and save them if this is |
* a Me2Me connection. |
* |
@@ -778,9 +777,8 @@ remoting.ClientSession.prototype.onSetScreenMode_ = function(event) { |
* false to disable this behaviour for subsequent window resizes--the |
* current host desktop size is not restored in this case. |
* @return {void} Nothing. |
- * @private |
*/ |
-remoting.ClientSession.prototype.setScreenMode_ = |
+remoting.ClientSession.prototype.setScreenMode = |
function(shrinkToFit, resizeToClient) { |
if (resizeToClient && !this.resizeToClient_) { |
var clientArea = this.getClientArea_(); |
@@ -982,6 +980,7 @@ remoting.ClientSession.prototype.onConnectionStatusUpdate_ = |
if (remoting.windowFrame) { |
remoting.windowFrame.setConnected(true); |
} |
+ remoting.toolbar.setClientSession(this); |
} else if (status == remoting.ClientSession.State.FAILED) { |
switch (error) { |