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

Side by Side Diff: remoting/webapp/client_session.js

Issue 136093013: Don't send mouse events if the plugin doesn't have focus. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Retry upload Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * Class handling creation and teardown of a remoting client session. 7 * Class handling creation and teardown of a remoting client session.
8 * 8 *
9 * The ClientSession class controls lifetime of the client plugin 9 * The ClientSession class controls lifetime of the client plugin
10 * object and provides the plugin with the functionality it needs to 10 * object and provides the plugin with the functionality it needs to
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 341
342 /** 342 /**
343 * Callback function called when the plugin element loses focus. 343 * Callback function called when the plugin element loses focus.
344 */ 344 */
345 remoting.ClientSession.prototype.pluginLostFocus_ = function() { 345 remoting.ClientSession.prototype.pluginLostFocus_ = function() {
346 if (this.plugin_) { 346 if (this.plugin_) {
347 // Release all keys to prevent them becoming 'stuck down' on the host. 347 // Release all keys to prevent them becoming 'stuck down' on the host.
348 this.plugin_.releaseAllKeys(); 348 this.plugin_.releaseAllKeys();
349 if (this.plugin_.element()) { 349 if (this.plugin_.element()) {
350 // Focus should stay on the element, not (for example) the toolbar. 350 // Focus should stay on the element, not (for example) the toolbar.
351 this.plugin_.element().focus(); 351 // Due to crbug.com/246335, we can't restore the focus immediately,
352 // otherwise the plugin gets confused about whether or not it has focus.
353 window.setTimeout(
354 this.plugin_.element().focus.bind(this.plugin_.element()),
355 0);
weitao 2014/02/07 23:54:23 Nice trick. :)
352 } 356 }
353 } 357 }
354 }; 358 };
355 359
356 /** 360 /**
357 * Adds <embed> element to |container| and readies the sesion object. 361 * Adds <embed> element to |container| and readies the sesion object.
358 * 362 *
359 * @param {Element} container The element to add the plugin to. 363 * @param {Element} container The element to add the plugin to.
360 * @param {function(string, string):boolean} onExtensionMessage The handler for 364 * @param {function(string, string):boolean} onExtensionMessage The handler for
361 * protocol extension messages. Returns true if a message is recognized; 365 * protocol extension messages. Returns true if a message is recognized;
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 * Sends a clipboard item to the host. 1357 * Sends a clipboard item to the host.
1354 * 1358 *
1355 * @param {string} mimeType The MIME type of the clipboard item. 1359 * @param {string} mimeType The MIME type of the clipboard item.
1356 * @param {string} item The clipboard item. 1360 * @param {string} item The clipboard item.
1357 */ 1361 */
1358 remoting.ClientSession.prototype.sendClipboardItem = function(mimeType, item) { 1362 remoting.ClientSession.prototype.sendClipboardItem = function(mimeType, item) {
1359 if (!this.plugin_) 1363 if (!this.plugin_)
1360 return; 1364 return;
1361 this.plugin_.sendClipboardItem(mimeType, item) 1365 this.plugin_.sendClipboardItem(mimeType, item)
1362 }; 1366 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698