diff options
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 |