diff options
author | simonmorris@chromium.org <simonmorris@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-27 20:50:58 +0000 |
---|---|---|
committer | simonmorris@chromium.org <simonmorris@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-27 20:50:58 +0000 |
commit | d86c63ca5cb21741595ce711a024dc285db580ac (patch) | |
tree | 253173d4740b3b4abf9bc1211d119b066fe7be7f /remoting | |
parent | e33facb5aa0cf69683833852e0c983c17ac05b15 (diff) | |
download | chromium_src-d86c63ca5cb21741595ce711a024dc285db580ac.zip chromium_src-d86c63ca5cb21741595ce711a024dc285db580ac.tar.gz chromium_src-d86c63ca5cb21741595ce711a024dc285db580ac.tar.bz2 |
[Chromoting] Only the plugin element listens for focus, not the whole document.
This also re-enables clipboard handling at the webapp, reverting the temporary
codereview.chromium.org/9845041 .
BUG=119838
Review URL: https://chromiumcodereview.appspot.com/9773033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129270 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/webapp/client_session.js | 13 | ||||
-rw-r--r-- | remoting/webapp/remoting.js | 15 |
2 files changed, 16 insertions, 12 deletions
diff --git a/remoting/webapp/client_session.js b/remoting/webapp/client_session.js index 2d314ab..f2862e5 100644 --- a/remoting/webapp/client_session.js +++ b/remoting/webapp/client_session.js @@ -186,6 +186,17 @@ remoting.ClientSession.prototype.createClientPlugin_ = function(container, id) { }; /** + * Callback function called when the plugin element gets focus. + */ +remoting.ClientSession.prototype.pluginGotFocus_ = function() { + // It would be cleaner to send a paste command to the plugin element, + // but that's not supported. + /** @type {function(string): void } */ + document.execCommand; + document.execCommand("paste"); +} + +/** * Adds <embed> element to |container| and readies the sesion object. * * @param {Element} container The element to add the plugin to. @@ -204,6 +215,8 @@ remoting.ClientSession.prototype.createPluginAndConnect = this.plugin.initialize(function(result) { that.onPluginInitialized_(oauth2AccessToken, result); }); + this.plugin.element().addEventListener( + 'focus', function() { that.pluginGotFocus_() }, false); }; /** diff --git a/remoting/webapp/remoting.js b/remoting/webapp/remoting.js index 8457476..26184d8 100644 --- a/remoting/webapp/remoting.js +++ b/remoting/webapp/remoting.js @@ -53,10 +53,10 @@ remoting.init = function() { document.getElementById('current-email').innerText = email; } - // The focus and paste hooks are disabled until crbug.com/119838 is fixed. - //window.addEventListener('focus', pluginGotFocus_, false); window.addEventListener('blur', pluginLostFocus_, false); - //window.addEventListener('paste', pluginGotPaste_, false); + // The plugin's onFocus handler sends a paste command to |window|, because + // it can't send one to the plugin element itself. + window.addEventListener('paste', pluginGotPaste_, false); if (isHostModeSupported_()) { var noShare = document.getElementById('chrome-os-no-share'); @@ -136,15 +136,6 @@ remoting.clearOAuth2 = function() { }; /** - * Callback function called when the browser window gets focus. - */ -function pluginGotFocus_() { - /** @type {function(string): void} */ - document.execCommand; - document.execCommand("paste"); -} - -/** * Callback function called when the browser window gets a paste operation. * * @param {Event} eventUncast |