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

Unified Diff: remoting/webapp/client_session.js

Issue 13932020: Set the initial resolution of an RDP session to the client screen resolution if it is available. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Clang Created 7 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
« no previous file with comments | « remoting/webapp/client_plugin_async.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/client_session.js
diff --git a/remoting/webapp/client_session.js b/remoting/webapp/client_session.js
index 5284e53b66a36799f820b146ac6b5a0b8bda6f32..a05e2e1e9ada4186ba823f0f7cf9169b5a28c918 100644
--- a/remoting/webapp/client_session.js
+++ b/remoting/webapp/client_session.js
@@ -228,6 +228,39 @@ remoting.ClientSession.prototype.error_ =
remoting.ClientSession.prototype.PLUGIN_ID = 'session-client-plugin';
/**
+ * Set of capabilities for which hasCapability_() can be used to test.
+ *
+ * @enum {string}
+ */
+remoting.ClientSession.Capability = {
+ // When enabled this capability causes the client to send its screen
+ // resolution to the host once connection has been established. See
+ // this.plugin.notifyClientResolution().
+ SEND_INITIAL_RESOLUTION: 'sendInitialResolution'
+};
+
+/**
+ * The set of capabilities negotiated between the client and host.
+ * @type {Array.<string>}
+ * @private
+ */
+remoting.ClientSession.prototype.capabilities_ = null;
+
+/**
+ * @param {remoting.ClientSession.Capability} capability The capability to test
+ * for.
+ * @return {boolean} True if the capability has been negotiated between
+ * the client and host.
+ * @private
+ */
+remoting.ClientSession.prototype.hasCapability_ = function(capability) {
+ if (this.capabilities_ == null)
+ return false;
+
+ return this.capabilities_.indexOf(capability) > -1;
+};
+
+/**
* @param {Element} container The element to add the plugin to.
* @param {string} id Id to use for the plugin element .
* @return {remoting.ClientPlugin} Create plugin object for the locally
@@ -369,6 +402,8 @@ remoting.ClientSession.prototype.onPluginInitialized_ = function(initialized) {
this.onConnectionReady_.bind(this);
this.plugin.onDesktopSizeUpdateHandler =
this.onDesktopSizeChanged_.bind(this);
+ this.plugin.onSetCapabilitiesHandler =
+ this.onSetCapabilities_.bind(this);
this.connectPluginToWcs_();
};
@@ -761,6 +796,29 @@ remoting.ClientSession.prototype.onConnectionReady_ = function(ready) {
}
/**
+ * Called when the client-host capabilities negotiation is complete.
+ *
+ * @param {!Array.<string>} capabilities The set of capabilities negotiated
+ * between the client and host.
+ * @return {void} Nothing.
+ * @private
+ */
+remoting.ClientSession.prototype.onSetCapabilities_ = function(capabilities) {
+ if (this.capabilities_ != null) {
+ console.error('onSetCapabilities_() is called more than once');
+ return;
+ }
+
+ this.capabilities_ = capabilities;
+ if (this.hasCapability_(
+ remoting.ClientSession.Capability.SEND_INITIAL_RESOLUTION)) {
+ this.plugin.notifyClientResolution(window.innerWidth,
+ window.innerHeight,
+ window.devicePixelRatio);
+ }
+};
+
+/**
* @private
* @param {remoting.ClientSession.State} newState The new state for the session.
* @return {void} Nothing.
« no previous file with comments | « remoting/webapp/client_plugin_async.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698