diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-03 19:07:30 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-03 19:07:30 +0000 |
commit | 4923229ec942699c100556ead557576a816a285c (patch) | |
tree | 438c07b04fbc19affdc194e8d88f580039774c09 /chrome/renderer | |
parent | 9715b85f74e95db5345fd33ef43ff48eb0ce983f (diff) | |
download | chromium_src-4923229ec942699c100556ead557576a816a285c.zip chromium_src-4923229ec942699c100556ead557576a816a285c.tar.gz chromium_src-4923229ec942699c100556ead557576a816a285c.tar.bz2 |
Fix initial plugin Mac plugin focus and visibily
Also simplifies the way initial window state is set, by sending the same message
that's used for later changes just after initialization instead of adding
parameters to the init message. While this means we send one more async message
if the plugin's renderer is visible, we remove an unnecessary synchronous call
to the browser procces for plugins in background tabs, and we defer that
synchronous call until after plugin initialization has started in the visible
case.
BUG=51391
TEST=Plugins loaded in a foreground page should react to keystrokes without having to switch tabs. Mouseovers should continue to work as before.
Review URL: http://codereview.chromium.org/3356006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58521 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/render_view.cc | 8 | ||||
-rw-r--r-- | chrome/renderer/render_widget.h | 2 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_proxy.cc | 12 |
3 files changed, 10 insertions, 12 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 7fa91bc..803abae 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -585,6 +585,14 @@ WebPlugin* RenderView::CreatePluginNoCheck(WebFrame* frame, #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()) { + delegate->SetContainerVisibility(true); + if (webview() && webview()->isActive()) + delegate->SetWindowFocus(true); + if (has_focus()) + delegate->SetContentAreaFocus(true); + } } void RenderView::UnregisterPluginDelegate(WebPluginDelegateProxy* delegate) { diff --git a/chrome/renderer/render_widget.h b/chrome/renderer/render_widget.h index a6de929..2d8ea717 100644 --- a/chrome/renderer/render_widget.h +++ b/chrome/renderer/render_widget.h @@ -224,6 +224,8 @@ 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 diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc index f1019cb..a5490af 100644 --- a/chrome/renderer/webplugin_delegate_proxy.cc +++ b/chrome/renderer/webplugin_delegate_proxy.cc @@ -375,18 +375,6 @@ bool WebPluginDelegateProxy::Initialize(const GURL& url, params.arg_values.push_back("opaque"); } } - - params.containing_window_frame = render_view_->rootWindowRect(); - // If the renderer isn't currently visible, don't bother asking for anything - // else; the plugin will get real data when its renderer becomes visible. - if (params.containing_window_frame.IsEmpty()) { - params.containing_content_frame = gfx::Rect(); - params.containing_window_has_focus = false; - } else { - params.containing_content_frame = render_view_->windowRect(); - WebKit::WebView* webview = render_view_->webview(); - params.containing_window_has_focus = webview && webview->isActive(); - } #endif params.load_manually = load_manually; |