From 700d3d58213d15dea1beb2f7f7122e77e7ea2a47 Mon Sep 17 00:00:00 2001 From: "evan@chromium.org" Date: Tue, 7 Jul 2009 17:40:46 +0000 Subject: linux: OOP windowed plugins There are still a few issues, but that's a start. - only windowed plugins - we can't currently create the gtksocket in background tabs, because their gtkwidgets are not yet in the hierarchy, so they can't be realized (that's what gives the XID). - the plugin process talks to the browser process through the renderer process to create/destroy the gtksockets, because the plugin doesn't know which renderer it's talking to. We need a bit more plumbing to be able to have direct IPC. - some code is duplicated between chrome and test_shell. We should probably refactor it, but I'm not sure where the common part should live. Patch from Antoine Labour , with some touchups by me. Review URL: http://codereview.chromium.org/146078 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20041 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/renderer/webplugin_delegate_proxy.cc | 29 ++++++++++++++++++++++------- chrome/renderer/webplugin_delegate_proxy.h | 6 +++++- 2 files changed, 27 insertions(+), 8 deletions(-) (limited to 'chrome/renderer') diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc index b98b728..ad70db1 100644 --- a/chrome/renderer/webplugin_delegate_proxy.cc +++ b/chrome/renderer/webplugin_delegate_proxy.cc @@ -331,6 +331,12 @@ void WebPluginDelegateProxy::InstallMissingPlugin() { void WebPluginDelegateProxy::OnMessageReceived(const IPC::Message& msg) { IPC_BEGIN_MESSAGE_MAP(WebPluginDelegateProxy, msg) IPC_MESSAGE_HANDLER(PluginHostMsg_SetWindow, OnSetWindow) +#if defined(OS_LINUX) + IPC_MESSAGE_HANDLER(PluginHostMsg_CreatePluginContainer, + OnCreatePluginContainer) + IPC_MESSAGE_HANDLER(PluginHostMsg_DestroyPluginContainer, + OnDestroyPluginContainer) +#endif #if defined(OS_WIN) IPC_MESSAGE_HANDLER(PluginHostMsg_SetWindowlessPumpEvent, OnSetWindowlessPumpEvent) @@ -634,17 +640,26 @@ int WebPluginDelegateProxy::GetProcessId() { return channel_host_->peer_pid(); } -void WebPluginDelegateProxy::OnSetWindow(gfx::NativeViewId window_id) { -#if defined(OS_WIN) - gfx::NativeView window = gfx::NativeViewFromId(window_id); - windowless_ = window == NULL; +void WebPluginDelegateProxy::OnSetWindow(gfx::PluginWindowHandle window) { + windowless_ = !window; if (plugin_) plugin_->SetWindow(window); -#else - NOTIMPLEMENTED(); -#endif } +#if defined(OS_LINUX) +void WebPluginDelegateProxy::OnCreatePluginContainer( + gfx::PluginWindowHandle* container) { + RenderThread::current()->Send(new ViewHostMsg_CreatePluginContainer( + render_view_->routing_id(), container)); +} + +void WebPluginDelegateProxy::OnDestroyPluginContainer( + gfx::PluginWindowHandle container) { + RenderThread::current()->Send(new ViewHostMsg_DestroyPluginContainer( + render_view_->routing_id(), container)); +} +#endif + #if defined(OS_WIN) void WebPluginDelegateProxy::OnSetWindowlessPumpEvent( HANDLE modal_loop_pump_messages_event) { diff --git a/chrome/renderer/webplugin_delegate_proxy.h b/chrome/renderer/webplugin_delegate_proxy.h index 3b8d616..e720815 100644 --- a/chrome/renderer/webplugin_delegate_proxy.h +++ b/chrome/renderer/webplugin_delegate_proxy.h @@ -106,7 +106,11 @@ class WebPluginDelegateProxy : public WebPluginDelegate, // Message handlers for messages that proxy WebPlugin methods, which // we translate into calls to the real WebPlugin. - void OnSetWindow(gfx::NativeViewId window); + void OnSetWindow(gfx::PluginWindowHandle window); +#if defined(OS_LINUX) + void OnCreatePluginContainer(gfx::PluginWindowHandle* container); + void OnDestroyPluginContainer(gfx::PluginWindowHandle container); +#endif #if defined(OS_WIN) void OnSetWindowlessPumpEvent(HANDLE modal_loop_pump_messages_event); #endif -- cgit v1.1