diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-08 15:52:13 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-08 15:52:13 +0000 |
commit | 1e6e3c99f8ca2ef9d8e86ddddec20dadc0fbf467 (patch) | |
tree | 95f198cfa03484708e1df0d75a909e4e99ad3134 /chrome/renderer/webplugin_delegate_proxy.cc | |
parent | 0e4898dee7088bf0e0e775ededf342fad6fe9606 (diff) | |
download | chromium_src-1e6e3c99f8ca2ef9d8e86ddddec20dadc0fbf467.zip chromium_src-1e6e3c99f8ca2ef9d8e86ddddec20dadc0fbf467.tar.gz chromium_src-1e6e3c99f8ca2ef9d8e86ddddec20dadc0fbf467.tar.bz2 |
Send window frame information to Mac plugins via IPC
Sends any window frame and relevent content view location changes to the plugin process via IPC, so that the plugin process always knows where the plugin is rather than only knowing when the mouse is within the plugin area. This will be necessary for supporting NPN_ConvertPoint, and for supporting Java2 as currently implemented.
Related changes:
- Now that window information is being sent on init and un-hide, use that to get correct initial window focus information.
- Add a missing window focus change notification uncovered by the above.
- Use live mouse location for idle events, instead of a cached location, now that we have live plugin frame information.
- Refactor and simplify the logic for moving the plugin.
Note that containing_window_frame_ is currently unused, but will be shortly for NPN_ConvertPoint, and is so closely related to the added IPC that I added it now rather than having to immediately change the new messages and functions.
BUG=34046,31858,31543,29457
TEST=Mouse tracking in Carbon plugins should still work correctly, even across window moves, info/bookmark bar show/hides, etc. (Automated tests of location tracking will follow shortly with full NPN_ConvertPoint implementation.)
Review URL: http://codereview.chromium.org/573015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38361 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/webplugin_delegate_proxy.cc')
-rw-r--r-- | chrome/renderer/webplugin_delegate_proxy.cc | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc index 2c87077..f4063e4 100644 --- a/chrome/renderer/webplugin_delegate_proxy.cc +++ b/chrome/renderer/webplugin_delegate_proxy.cc @@ -283,6 +283,18 @@ bool WebPluginDelegateProxy::Initialize(const GURL& url, params.arg_names.push_back("wmode"); 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; @@ -874,16 +886,32 @@ void WebPluginDelegateProxy::SetWindowFocus(bool window_has_focus) { } void WebPluginDelegateProxy::SetContainerVisibility(bool is_visible) { - // TODO(stuartmorgan): Split this into two messages, and send location and - // focus information with the "became visible" version since the plugins in a - // hidden tab will not have been getting live updates. - IPC::Message* msg = new PluginMsg_SetContainerVisibility(instance_id_, - is_visible); + IPC::Message* msg; + if (is_visible) { + gfx::Rect window_frame = render_view_->rootWindowRect(); + gfx::Rect view_frame = render_view_->windowRect(); + WebKit::WebView* webview = render_view_->webview(); + msg = new PluginMsg_ContainerShown(instance_id_, window_frame, view_frame, + webview && webview->isActive()); + } else { + msg = new PluginMsg_ContainerHidden(instance_id_); + } // Make sure visibility events are delivered in the right order relative to // sync messages they might interact with (Paint, HandleEvent, etc.). msg->set_unblock(true); Send(msg); } + +void WebPluginDelegateProxy::WindowFrameChanged(gfx::Rect window_frame, + gfx::Rect view_frame) { + IPC::Message* msg = new PluginMsg_WindowFrameChanged(instance_id_, + window_frame, + view_frame); + // Make sure frame events are delivered in the right order relative to + // sync messages they might interact with (e.g., HandleEvent). + msg->set_unblock(true); + Send(msg); +} #endif // OS_MACOSX void WebPluginDelegateProxy::OnSetWindow(gfx::PluginWindowHandle window) { |