diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-29 23:57:54 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-29 23:57:54 +0000 |
commit | 9fa82bb8872a34275f3e0832f33339a4d07fa33b (patch) | |
tree | c5bafa8a9d5f0cf931834ad750f909b17e4c9534 /webkit/glue | |
parent | 893a5ccce13082aa85686ad142c0d8be0fb5cd70 (diff) | |
download | chromium_src-9fa82bb8872a34275f3e0832f33339a4d07fa33b.zip chromium_src-9fa82bb8872a34275f3e0832f33339a4d07fa33b.tar.gz chromium_src-9fa82bb8872a34275f3e0832f33339a4d07fa33b.tar.bz2 |
linux: only create browser-side plugin container after plugin requests it
On Windows, windowed plugins are parented in a two-stage process: initially,
the plugin is parented to the render view, then later it's reparented to
a special per-plugin window.
On Linux, plugin embedding always needs a special per-plugin window before
it can be initialized. So there's no way to do the two-stage initialization
process, and we only want to construct the browser-side plugin container for
windowed plugins after the plugin requests it.
Plumbing this through the WebPlugin interface will also allow us to side-route
this request for window creation out to the browser process in the
multi-process case.
BUG=15421
TEST=plugins still work in test_shell
Review URL: http://codereview.chromium.org/150034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19560 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl_gtk.cc | 10 | ||||
-rw-r--r-- | webkit/glue/webplugin.h | 7 | ||||
-rw-r--r-- | webkit/glue/webplugin_impl.cc | 11 | ||||
-rw-r--r-- | webkit/glue/webplugin_impl.h | 5 | ||||
-rw-r--r-- | webkit/glue/webview_delegate.h | 4 |
5 files changed, 30 insertions, 7 deletions
diff --git a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc index c20fee0..9f9838b 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc @@ -263,12 +263,10 @@ bool WebPluginDelegateImpl::WindowedCreatePlugin() { return false; } - window_.window = reinterpret_cast<void*>(parent_); - // The remainder of the code expects windowed_handle_ to exist for - // windowed mode, despite not actually ever reaching through - // windowed_handle_. It is still used as a token to represent "this - // plugin" in messages to the browser. - windowed_handle_ = parent_; + // Xembed plugins need a window created for them browser-side. + // Do that now. + windowed_handle_ = plugin_->CreatePluginContainer(); + window_.window = reinterpret_cast<void*>(windowed_handle_); if (!window_.ws_info) window_.ws_info = new NPSetWindowCallbackStruct; diff --git a/webkit/glue/webplugin.h b/webkit/glue/webplugin.h index 2debf9a..07d2470 100644 --- a/webkit/glue/webplugin.h +++ b/webkit/glue/webplugin.h @@ -52,6 +52,13 @@ class WebPlugin { WebPlugin() { } virtual ~WebPlugin() { } +#if defined(OS_LINUX) + // Called by the plugin delegate to request a container for a new + // windowed plugin. This handle will later get destroyed with + // WillDestroyWindow. + virtual gfx::PluginWindowHandle CreatePluginContainer() = 0; +#endif + // Called by the plugin delegate to let the WebPlugin know if the plugin is // windowed (i.e. handle is not NULL) or windowless (handle is NULL). This // tells the WebPlugin to send mouse/keyboard events to the plugin delegate, diff --git a/webkit/glue/webplugin_impl.cc b/webkit/glue/webplugin_impl.cc index 35ea7b2..e554255 100644 --- a/webkit/glue/webplugin_impl.cc +++ b/webkit/glue/webplugin_impl.cc @@ -388,6 +388,17 @@ WebPluginImpl::WebPluginImpl(WebCore::HTMLPlugInElement* element, WebPluginImpl::~WebPluginImpl() { } +#if defined(OS_LINUX) +gfx::PluginWindowHandle WebPluginImpl::CreatePluginContainer() { + WebCore::Frame* frame = element_->document()->frame(); + WebFrameImpl* webframe = WebFrameImpl::FromFrame(frame); + WebViewImpl* webview = webframe->GetWebViewImpl(); + if (!webview->delegate()) + return 0; + return webview->delegate()->CreatePluginContainer(); +} +#endif + void WebPluginImpl::SetWindow(gfx::PluginWindowHandle window) { if (window) { DCHECK(!windowless_); // Make sure not called twice. diff --git a/webkit/glue/webplugin_impl.h b/webkit/glue/webplugin_impl.h index 7d51f39..b81e8a9 100644 --- a/webkit/glue/webplugin_impl.h +++ b/webkit/glue/webplugin_impl.h @@ -113,7 +113,7 @@ class WebPluginContainer : public WebCore::Widget { }; // This is the WebKit side of the plugin implementation that forwards calls, -// after changing out of WebCore types, to a delegate. The delegate will +// after changing out of WebCore types, to a delegate. The delegate may // be in a different process. class WebPluginImpl : public WebPlugin, public WebKit::WebURLLoaderClient { @@ -148,6 +148,9 @@ class WebPluginImpl : public WebPlugin, int arg_count, char** arg_names, char** arg_values); // WebPlugin implementation: +#if defined(OS_LINUX) + gfx::PluginWindowHandle CreatePluginContainer(); +#endif void SetWindow(gfx::PluginWindowHandle window); void WillDestroyWindow(gfx::PluginWindowHandle window); #if defined(OS_WIN) diff --git a/webkit/glue/webview_delegate.h b/webkit/glue/webview_delegate.h index 7fe792f..6106d1d 100644 --- a/webkit/glue/webview_delegate.h +++ b/webkit/glue/webview_delegate.h @@ -133,6 +133,10 @@ class WebViewDelegate : virtual public WebWidgetDelegate { return NULL; } + // Called when a windowed plugin is initializing, to request a container + // for the plugin. Only used on Linux. + virtual gfx::PluginWindowHandle CreatePluginContainer() { return 0; } + // Called when a windowed plugin is closing. // Lets the view delegate shut down anything it is using to wrap the plugin. virtual void WillDestroyPluginWindow(gfx::PluginWindowHandle handle) { } |