diff options
author | amanda@chromium.org <amanda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-20 18:26:16 +0000 |
---|---|---|
committer | amanda@chromium.org <amanda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-20 18:26:16 +0000 |
commit | 27f5a6c85610ac97a87bc64918ead7891f58fda5 (patch) | |
tree | 8454f2a3e2526b203628c0e434ebee62e563ad0b /chrome/plugin/webplugin_delegate_stub.cc | |
parent | 8806b8a53168e161e8a2cbbf4051067c095832a9 (diff) | |
download | chromium_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/plugin/webplugin_delegate_stub.cc')
-rw-r--r-- | chrome/plugin/webplugin_delegate_stub.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/chrome/plugin/webplugin_delegate_stub.cc b/chrome/plugin/webplugin_delegate_stub.cc index a4dabfb..6807b7b 100644 --- a/chrome/plugin/webplugin_delegate_stub.cc +++ b/chrome/plugin/webplugin_delegate_stub.cc @@ -46,6 +46,22 @@ class FinishDestructionTask : public Task { WebPlugin* webplugin_; }; +#if defined(OS_MACOSX) +namespace { + +void FocusNotifier(WebPluginDelegateImpl *instance) { + uint32 process_id = getpid(); + uint32 instance_id = reinterpret_cast<uint32>(instance); + PluginThread* plugin_thread = PluginThread::current(); + if (plugin_thread) { + plugin_thread->Send( + new PluginProcessHostMsg_PluginReceivedFocus(process_id, instance_id)); + } +} + +} +#endif + WebPluginDelegateStub::WebPluginDelegateStub( const std::string& mime_type, int instance_id, PluginChannel* channel) : mime_type_(mime_type), @@ -164,6 +180,9 @@ void WebPluginDelegateStub::OnInit(const PluginMsg_Init_Params& params, params.arg_values, webplugin_, params.load_manually); +#if defined(OS_MACOSX) + delegate_->SetFocusNotifier(FocusNotifier); +#endif } } |