diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-18 00:02:34 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-18 00:02:34 +0000 |
commit | 784ea1ab3797a0aade739c3d80f9f12b41160aef (patch) | |
tree | c3abea80550ba03a41eab24e7579d9b0df1beb4f /chrome/renderer/render_view.cc | |
parent | 9c0a58008e54678318d98d0a519bd47e9bd84f07 (diff) | |
download | chromium_src-784ea1ab3797a0aade739c3d80f9f12b41160aef.zip chromium_src-784ea1ab3797a0aade739c3d80f9f12b41160aef.tar.gz chromium_src-784ea1ab3797a0aade739c3d80f9f12b41160aef.tar.bz2 |
Extend improved windowless plugin focus handling to all platforms
Uses the same two-state focus tracking that the Mac currently uses on Windows and Linux as well, so focus is updated correctly when the content area itself gains and loses focus.
BUG=55607
TEST=Windowless plugins should handle key events when focused on all platforms.
Review URL: http://codereview.chromium.org/3397015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59877 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_view.cc')
-rw-r--r-- | chrome/renderer/render_view.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 9f1fcb6..9e33f83 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -597,23 +597,25 @@ WebPlugin* RenderView::CreatePluginNoCheck(WebFrame* frame, return CreateNPAPIPlugin(frame, params, info.path, mime_type); } -#if defined(OS_MACOSX) void RenderView::RegisterPluginDelegate(WebPluginDelegateProxy* delegate) { plugin_delegates_.insert(delegate); // If the renderer is visible, set initial visibility and focus state. if (!is_hidden()) { +#if defined(OS_MACOSX) delegate->SetContainerVisibility(true); if (webview() && webview()->isActive()) delegate->SetWindowFocus(true); - if (has_focus()) - delegate->SetContentAreaFocus(true); +#endif } + // Plugins start assuming the content has focus (so that they work in + // environments where RenderView isn't hosting them), so we always have to + // set the initial state. See webplugin_delegate_impl.h for details. + delegate->SetContentAreaFocus(has_focus()); } void RenderView::UnregisterPluginDelegate(WebPluginDelegateProxy* delegate) { plugin_delegates_.erase(delegate); } -#endif void RenderView::Init(gfx::NativeViewId parent_hwnd, int32 opener_id, @@ -5632,6 +5634,7 @@ void RenderView::OnWasRestored(bool needs_repainting) { (*plugin_it)->SetContainerVisibility(true); } } +#endif // OS_MACOSX void RenderView::OnSetFocus(bool enable) { RenderWidget::OnSetFocus(enable); @@ -5640,15 +5643,16 @@ void RenderView::OnSetFocus(bool enable) { std::set<WebPluginDelegateProxy*>::iterator plugin_it; for (plugin_it = plugin_delegates_.begin(); plugin_it != plugin_delegates_.end(); ++plugin_it) { +#if defined(OS_MACOSX) // RenderWidget's call to setFocus can cause the underlying webview's // activation state to change just like a call to setIsActive. if (enable) (*plugin_it)->SetWindowFocus(true); +#endif (*plugin_it)->SetContentAreaFocus(enable); } } } -#endif // OS_MACOSX void RenderView::EnsureDocumentTag() { // TODO(darin): There's actually no reason for this to be here. We should |