summaryrefslogtreecommitdiffstats
path: root/chrome/browser/plugin_process_host_mac.cc
diff options
context:
space:
mode:
authoramanda@chromium.org <amanda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-20 18:26:16 +0000
committeramanda@chromium.org <amanda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-20 18:26:16 +0000
commit27f5a6c85610ac97a87bc64918ead7891f58fda5 (patch)
tree8454f2a3e2526b203628c0e434ebee62e563ad0b /chrome/browser/plugin_process_host_mac.cc
parent8806b8a53168e161e8a2cbbf4051067c095832a9 (diff)
downloadchromium_src-27f5a6c85610ac97a87bc64918ead7891f58fda5.zip
chromium_src-27f5a6c85610ac97a87bc64918ead7891f58fda5.tar.gz
chromium_src-27f5a6c85610ac97a87bc64918ead7891f58fda5.tar.bz2
Mac: Simulate the OS-level focus handling that windows and linux plugins
rely on to trigger NPAPI keyboard focus notifications. BUG=26585 TEST=On pages with multiple Flash text entry fields, only one should have a blinking caret at any time. Flash elements that use the ActionScript2 "Key.IsDown()" function should only detect keydowns when they are in a visible tab and focused. Review URL: http://codereview.chromium.org/399090 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32631 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/plugin_process_host_mac.cc')
-rw-r--r--chrome/browser/plugin_process_host_mac.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/chrome/browser/plugin_process_host_mac.cc b/chrome/browser/plugin_process_host_mac.cc
index bea1cbc..f1f0ff8 100644
--- a/chrome/browser/plugin_process_host_mac.cc
+++ b/chrome/browser/plugin_process_host_mac.cc
@@ -12,6 +12,8 @@
#include "base/mac_util.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/plugin_process_host.h"
+#include "chrome/common/plugin_messages.h"
+
void PluginProcessHost::OnPluginSelectWindow(uint32 window_id,
gfx::Rect window_rect,
@@ -75,3 +77,16 @@ void PluginProcessHost::OnAppActivation() {
NewRunnableFunction(mac_util::ActivateProcess, handle()));
}
}
+
+void PluginProcessHost::OnPluginReceivedFocus(int process_id, int instance_id) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
+ // A plugin has received keyboard focus, so tell all other plugin processes
+ // that they no longer have it (simulating the OS-level focus notifications
+ // that Gtk and Windows provide).
+ for (ChildProcessHost::Iterator iter(ChildProcessInfo::PLUGIN_PROCESS);
+ !iter.Done(); ++iter) {
+ PluginProcessHost* plugin = static_cast<PluginProcessHost*>(*iter);
+ int instance = (plugin->handle() == process_id) ? instance_id : 0;
+ plugin->Send(new PluginProcessMsg_PluginFocusNotify(instance));
+ }
+}