Skip to content

Commit

Permalink
[Chromoting] Enable support for mouselock in the webapp.
Browse files Browse the repository at this point in the history
NOTRY=True
BUG=

Review URL: https://codereview.chromium.org/713423002

Cr-Commit-Position: refs/heads/master@{#303762}
  • Loading branch information
garykac authored and Commit bot committed Nov 12, 2014
1 parent cd1e2f2 commit acc031c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
6 changes: 6 additions & 0 deletions remoting/webapp/crd/js/client_plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ remoting.ClientPlugin.prototype.requestPairing =
*/
remoting.ClientPlugin.prototype.onPinFetched = function(pin) {};

/**
* Allows automatic mouse-lock.
*/
remoting.ClientPlugin.prototype.allowMouseLock = function() {};

/**
* Sets the third party authentication token and shared secret.
*
Expand Down Expand Up @@ -289,6 +294,7 @@ remoting.ClientPlugin.Feature = {
THIRD_PARTY_AUTH: 'thirdPartyAuth',
TRAP_KEY: 'trapKey',
PINLESS_AUTH: 'pinlessAuth',
ALLOW_MOUSE_LOCK: 'allowMouseLock',
EXTENSION_MESSAGE: 'extensionMessage',
MEDIA_SOURCE_RENDERING: 'mediaSourceRendering',
VIDEO_CONTROL: 'videoControl'
Expand Down
8 changes: 8 additions & 0 deletions remoting/webapp/crd/js/client_plugin_impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,14 @@ remoting.ClientPluginImpl.prototype.useAsyncPinDialog =
{ method: 'useAsyncPinDialog', data: {} }));
};

/**
* Allows automatic mouse-lock.
*/
remoting.ClientPluginImpl.prototype.allowMouseLock = function() {
this.plugin_.postMessage(JSON.stringify(
{ method: 'allowMouseLock', data: {} }));
};

/**
* Sets the third party authentication token and shared secret.
*
Expand Down
19 changes: 19 additions & 0 deletions remoting/webapp/crd/js/client_session.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ var remoting = remoting || {};
*/
remoting.enableCast = false;

/**
* True to enable mouse lock.
* This is currently disabled because the current client plugin does not
* properly handle mouse lock and delegated large cursors at the same time.
* This should be re-enabled (by removing this flag) once a version of
* the plugin that supports both has reached Chrome Stable channel.
* (crbug.com/429322).
*
* @type {boolean}
*/
remoting.enableMouseLock = false;

/**
* @param {remoting.SignalStrategy} signalStrategy Signal strategy.
* @param {HTMLElement} container Container element for the client view.
Expand Down Expand Up @@ -507,6 +519,13 @@ remoting.ClientSession.prototype.onPluginInitialized_ = function(initialized) {
this.applyRemapKeys_(true);
}

// TODO(wez): Only allow mouse lock if the app has the pointerLock permission.
// Enable automatic mouse-lock.
if (remoting.enableMouseLock &&
this.plugin_.hasFeature(remoting.ClientPlugin.Feature.ALLOW_MOUSE_LOCK)) {
this.plugin_.allowMouseLock();
}

// Enable MediaSource-based rendering on Chrome 37 and above.
var chromeVersionMajor =
parseInt((remoting.getChromeVersion() || '0').split('.')[0], 10);
Expand Down

0 comments on commit acc031c

Please sign in to comment.