diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-23 22:01:07 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-23 22:01:07 +0000 |
commit | 589621be31d785936fa1bef364077300bb495d12 (patch) | |
tree | 8ecc2ba500b7b94615a65ca5fdf0978d1f1e494e /chrome/renderer | |
parent | fdf9926defcc577462b00ce3f851f1902dfba6a2 (diff) | |
download | chromium_src-589621be31d785936fa1bef364077300bb495d12.zip chromium_src-589621be31d785936fa1bef364077300bb495d12.tar.gz chromium_src-589621be31d785936fa1bef364077300bb495d12.tar.bz2 |
Implement Pepper plugin focus notifications.
This hooks up both webkit focus and content area focus like we do for NPAPI plugins.
BUG=56671
TEST=none
Review URL: http://codereview.chromium.org/3493011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60361 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/pepper_plugin_delegate_impl.cc | 10 | ||||
-rw-r--r-- | chrome/renderer/pepper_plugin_delegate_impl.h | 4 | ||||
-rw-r--r-- | chrome/renderer/render_view.cc | 4 | ||||
-rw-r--r-- | chrome/renderer/render_widget.h | 4 |
4 files changed, 20 insertions, 2 deletions
diff --git a/chrome/renderer/pepper_plugin_delegate_impl.cc b/chrome/renderer/pepper_plugin_delegate_impl.cc index 3a866af..7ca9d4e 100644 --- a/chrome/renderer/pepper_plugin_delegate_impl.cc +++ b/chrome/renderer/pepper_plugin_delegate_impl.cc @@ -523,6 +523,9 @@ void PepperPluginDelegateImpl::ViewFlushedPaint() { void PepperPluginDelegateImpl::InstanceCreated( pepper::PluginInstance* instance) { active_instances_.insert(instance); + + // Set the initial focus. + instance->SetContentAreaFocus(render_view_->has_focus()); } void PepperPluginDelegateImpl::InstanceDeleted( @@ -639,6 +642,13 @@ void PepperPluginDelegateImpl::OnAsyncFileOpened( delete callback; } +void PepperPluginDelegateImpl::OnSetFocus(bool has_focus) { + for (std::set<pepper::PluginInstance*>::iterator i = + active_instances_.begin(); + i != active_instances_.end(); ++i) + (*i)->SetContentAreaFocus(has_focus); +} + scoped_refptr<base::MessageLoopProxy> PepperPluginDelegateImpl::GetFileThreadMessageLoopProxy() { return RenderThread::current()->GetFileThreadMessageLoopProxy(); diff --git a/chrome/renderer/pepper_plugin_delegate_impl.h b/chrome/renderer/pepper_plugin_delegate_impl.h index 19f08b1c..a5808d5 100644 --- a/chrome/renderer/pepper_plugin_delegate_impl.h +++ b/chrome/renderer/pepper_plugin_delegate_impl.h @@ -46,6 +46,10 @@ class PepperPluginDelegateImpl base::PlatformFile file, int message_id); + // Notification that the render view has been focused or defocused. This + // notifies all of the plugins. + void OnSetFocus(bool has_focus); + // pepper::PluginDelegate implementation. virtual void InstanceCreated(pepper::PluginInstance* instance); virtual void InstanceDeleted(pepper::PluginInstance* instance); diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 8dceb39..b570f7e 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -5639,6 +5639,7 @@ void RenderView::OnSetFocus(bool enable) { RenderWidget::OnSetFocus(enable); if (webview() && webview()->isActive()) { + // Notify all NPAPI plugins. std::set<WebPluginDelegateProxy*>::iterator plugin_it; for (plugin_it = plugin_delegates_.begin(); plugin_it != plugin_delegates_.end(); ++plugin_it) { @@ -5650,6 +5651,9 @@ void RenderView::OnSetFocus(bool enable) { #endif (*plugin_it)->SetContentAreaFocus(enable); } + + // Notify all Pepper plugins. + pepper_delegate_.OnSetFocus(enable); } } diff --git a/chrome/renderer/render_widget.h b/chrome/renderer/render_widget.h index 7f9e247..f08f333 100644 --- a/chrome/renderer/render_widget.h +++ b/chrome/renderer/render_widget.h @@ -88,6 +88,8 @@ class RenderWidget : public IPC::Channel::Listener, return host_window_; } + bool has_focus() const { return has_focus_; } + // IPC::Channel::Listener virtual void OnMessageReceived(const IPC::Message& msg); @@ -223,8 +225,6 @@ class RenderWidget : public IPC::Channel::Listener, // the focus on our own when the browser did not focus us. void ClearFocus(); - bool has_focus() const { return has_focus_; } - // Set the pending window rect. // Because the real render_widget is hosted in another process, there is // a time period where we may have set a new window rect which has not yet |