summaryrefslogtreecommitdiffstats
path: root/remoting/webapp/client_session.js
diff options
context:
space:
mode:
authorwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-02 01:23:31 +0000
committerwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-02 01:23:31 +0000
commite7abceee38257be619d799b26b57c522ac504669 (patch)
tree4cf7d7aa673c2d5d8a10de8a3db54aa089f39c4e /remoting/webapp/client_session.js
parent0b3ec609f485f457667127abd2b2752fd075955a (diff)
downloadchromium_src-e7abceee38257be619d799b26b57c522ac504669.zip
chromium_src-e7abceee38257be619d799b26b57c522ac504669.tar.gz
chromium_src-e7abceee38257be619d799b26b57c522ac504669.tar.bz2
Send new client dimensions to host whenever they change.
This will be manually testable by checking for NotifyClientDimensions messages logged by hosts, once the host end logging is enabled. DO NOT COMMIT THIS UNTIL CL 10262035 HAS LANDED. BUG=110212 Review URL: http://codereview.chromium.org/10265033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134846 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/webapp/client_session.js')
-rw-r--r--remoting/webapp/client_session.js29
1 files changed, 25 insertions, 4 deletions
diff --git a/remoting/webapp/client_session.js b/remoting/webapp/client_session.js
index 8fab461..d7dc798 100644
--- a/remoting/webapp/client_session.js
+++ b/remoting/webapp/client_session.js
@@ -58,6 +58,10 @@ remoting.ClientSession = function(hostJid, hostPublicKey, sharedSecret,
this.scaleToFit = false;
this.logToServer = new remoting.LogToServer();
this.onStateChange = onStateChange;
+
+ /** @type {number?} */
+ this.notifyClientDimensionsTimer_ = null;
+
/** @type {remoting.ClientSession} */
var that = this;
/** @type {function():void} @private */
@@ -71,20 +75,22 @@ remoting.ClientSession = function(hostJid, hostPublicKey, sharedSecret,
/** @type {function():void} @private */
this.callToggleFullScreen_ = function() { that.toggleFullScreen_(); };
/** @type {remoting.MenuButton} @private */
- this.sendKeysMenu_ = new remoting.MenuButton(
- document.getElementById('send-keys-menu')
- );
- /** @type {remoting.MenuButton} @private */
this.screenOptionsMenu_ = new remoting.MenuButton(
document.getElementById('screen-options-menu'),
function() { that.onShowOptionsMenu_(); }
);
+ /** @type {remoting.MenuButton} @private */
+ this.sendKeysMenu_ = new remoting.MenuButton(
+ document.getElementById('send-keys-menu')
+ );
+
/** @type {HTMLElement} @private */
this.shrinkToFit_ = document.getElementById('enable-shrink-to-fit');
/** @type {HTMLElement} @private */
this.originalSize_ = document.getElementById('disable-shrink-to-fit');
/** @type {HTMLElement} @private */
this.fullScreen_ = document.getElementById('toggle-full-screen');
+
this.shrinkToFit_.addEventListener('click', this.callEnableShrink_, false);
this.originalSize_.addEventListener('click', this.callDisableShrink_, false);
this.fullScreen_.addEventListener('click', this.callToggleFullScreen_, false);
@@ -504,6 +510,21 @@ remoting.ClientSession.prototype.setState_ = function(newState) {
*/
remoting.ClientSession.prototype.onResize = function() {
this.updateDimensions();
+
+ if (this.notifyClientDimensionsTimer_) {
+ window.clearTimeout(this.notifyClientDimensionsTimer_);
+ this.notifyClientDimensionsTimer_ = null;
+ }
+
+ // Defer notifying the host of the change until the window stops resizing, to
+ // avoid overloading the control channel with notifications.
+ /** @type {remoting.ClientSession} */
+ var that = this;
+ var notifyClientDimensions = function() {
+ that.plugin.notifyClientDimensions(window.innerWidth, window.innerHeight);
+ }
+ this.notifyClientDimensionsTimer_ =
+ window.setTimeout(notifyClientDimensions, 1000);
};
/**