summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-06 20:32:41 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-06 20:32:41 +0000
commite4c0329c31debaec3b5fe8a1136321c143de7d97 (patch)
tree29609d0333ce7841305b942653085fb413e30b79 /chrome
parent1ee61486ee0854be7b82d9fca66bb49d563ede4c (diff)
downloadchromium_src-e4c0329c31debaec3b5fe8a1136321c143de7d97.zip
chromium_src-e4c0329c31debaec3b5fe8a1136321c143de7d97.tar.gz
chromium_src-e4c0329c31debaec3b5fe8a1136321c143de7d97.tar.bz2
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 factor it, but I'm not sure where the common part should live. Review URL: http://codereview.chromium.org/146078 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19983 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/plugin_process_host.cc17
-rw-r--r--chrome/browser/plugin_process_host.h4
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc5
-rw-r--r--chrome/browser/renderer_host/render_widget_host.cc18
-rw-r--r--chrome/browser/renderer_host/render_widget_host.h4
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view.h5
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_gtk.cc22
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_gtk.h6
-rw-r--r--chrome/browser/renderer_host/test/test_render_view_host.h5
-rw-r--r--chrome/common/plugin_messages_internal.h22
-rw-r--r--chrome/common/render_messages_internal.h7
-rw-r--r--chrome/plugin/plugin_main.cc16
-rw-r--r--chrome/plugin/webplugin_delegate_stub.cc13
-rw-r--r--chrome/plugin/webplugin_proxy.cc25
-rw-r--r--chrome/plugin/webplugin_proxy.h4
-rw-r--r--chrome/renderer/webplugin_delegate_proxy.cc29
-rw-r--r--chrome/renderer/webplugin_delegate_proxy.h6
17 files changed, 173 insertions, 35 deletions
diff --git a/chrome/browser/plugin_process_host.cc b/chrome/browser/plugin_process_host.cc
index 55885bd..bfe5ea8 100644
--- a/chrome/browser/plugin_process_host.cc
+++ b/chrome/browser/plugin_process_host.cc
@@ -20,6 +20,7 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/file_version_info.h"
+#include "base/gfx/native_widget_types.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/process_util.h"
@@ -58,6 +59,10 @@
#include "chrome/common/ipc_channel_posix.h"
#endif
+#if defined(OS_LINUX)
+#include "base/gfx/gtk_native_view_id_manager.h"
+#endif
+
static const char kDefaultPluginFinderURL[] =
"http://dl.google.com/chrome/plugins/plugins2.xml";
@@ -288,6 +293,14 @@ void PluginProcessHost::AddWindow(HWND window) {
#endif // defined(OS_WIN)
+#if defined(OS_LINUX)
+void PluginProcessHost::OnMapNativeViewId(gfx::NativeViewId id,
+ gfx::PluginWindowHandle* output) {
+ *output = 0;
+ Singleton<GtkNativeViewManager>()->GetXIDForId(output, id);
+}
+#endif // defined(OS_LINUX)
+
PluginProcessHost::PluginProcessHost()
: ChildProcessHost(
PLUGIN_PROCESS,
@@ -438,6 +451,10 @@ void PluginProcessHost::OnMessageReceived(const IPC::Message& msg) {
OnPluginWindowDestroyed)
IPC_MESSAGE_HANDLER(PluginProcessHostMsg_DownloadUrl, OnDownloadUrl)
#endif
+#if defined(OS_LINUX)
+ IPC_MESSAGE_HANDLER(PluginProcessHostMsg_MapNativeViewId,
+ OnMapNativeViewId)
+#endif
IPC_MESSAGE_UNHANDLED_ERROR()
IPC_END_MESSAGE_MAP()
}
diff --git a/chrome/browser/plugin_process_host.h b/chrome/browser/plugin_process_host.h
index 72a5d78..62efdbd 100644
--- a/chrome/browser/plugin_process_host.h
+++ b/chrome/browser/plugin_process_host.h
@@ -110,6 +110,10 @@ class PluginProcessHost : public ChildProcessHost,
gfx::NativeWindow caller_window);
#endif
+#if defined(OS_LINUX)
+ void OnMapNativeViewId(gfx::NativeViewId id, gfx::PluginWindowHandle* output);
+#endif
+
virtual bool CanShutdown() { return sent_requests_.empty(); }
struct ChannelRequest {
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index b7e0ad5..c06d4fa 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -671,6 +671,10 @@ bool RenderViewHost::SuddenTerminationAllowed() const {
// RenderViewHost, IPC message handlers:
void RenderViewHost::OnMessageReceived(const IPC::Message& msg) {
+#if !defined(OS_LINUX)
+ // On Windows there's a potential deadlock with sync messsages going in
+ // a circle from browser -> plugin -> renderer -> browser.
+ // On Linux we can avoid this by avoiding sync messages from browser->plugin.
if (msg.is_sync() && !msg.is_caller_pumping_messages()) {
NOTREACHED() << "Can't send sync messages to UI thread without pumping "
"messages in the renderer or else deadlocks can occur if the page "
@@ -680,6 +684,7 @@ void RenderViewHost::OnMessageReceived(const IPC::Message& msg) {
Send(reply);
return;
}
+#endif
bool msg_is_ok = true;
IPC_BEGIN_MESSAGE_MAP_EX(RenderViewHost, msg, msg_is_ok)
diff --git a/chrome/browser/renderer_host/render_widget_host.cc b/chrome/browser/renderer_host/render_widget_host.cc
index 5dec932..88c8c51 100644
--- a/chrome/browser/renderer_host/render_widget_host.cc
+++ b/chrome/browser/renderer_host/render_widget_host.cc
@@ -120,6 +120,12 @@ IPC_DEFINE_MESSAGE_MAP(RenderWidgetHost)
IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor)
IPC_MESSAGE_HANDLER(ViewHostMsg_ImeUpdateStatus, OnMsgImeUpdateStatus)
IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_ShowPopup, OnMsgShowPopup(msg))
+#if defined(OS_LINUX)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_CreatePluginContainer,
+ OnMsgCreatePluginContainer)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_DestroyPluginContainer,
+ OnMsgDestroyPluginContainer)
+#endif
IPC_MESSAGE_UNHANDLED_ERROR()
IPC_END_MESSAGE_MAP()
@@ -748,6 +754,18 @@ void RenderWidgetHost::OnMsgShowPopup(const IPC::Message& message) {
#endif
}
+#if defined(OS_LINUX)
+void RenderWidgetHost::OnMsgCreatePluginContainer(
+ gfx::PluginWindowHandle *container) {
+ *container = view_->CreatePluginContainer();
+}
+
+void RenderWidgetHost::OnMsgDestroyPluginContainer(
+ gfx::PluginWindowHandle container) {
+ view_->DestroyPluginContainer(container);
+}
+#endif
+
void RenderWidgetHost::PaintBackingStoreRect(TransportDIB* bitmap,
const gfx::Rect& bitmap_rect,
const gfx::Size& view_size) {
diff --git a/chrome/browser/renderer_host/render_widget_host.h b/chrome/browser/renderer_host/render_widget_host.h
index c551498..cf3f9d5 100644
--- a/chrome/browser/renderer_host/render_widget_host.h
+++ b/chrome/browser/renderer_host/render_widget_host.h
@@ -392,6 +392,10 @@ class RenderWidgetHost : public IPC::Channel::Listener {
// having to bring in render_messages.h in a header file.
void OnMsgImeUpdateStatus(int control, const gfx::Rect& caret_rect);
void OnMsgShowPopup(const IPC::Message& message);
+#if defined(OS_LINUX)
+ void OnMsgCreatePluginContainer(gfx::PluginWindowHandle *container);
+ void OnMsgDestroyPluginContainer(gfx::PluginWindowHandle container);
+#endif
// Paints the given bitmap to the current backing store at the given location.
void PaintBackingStoreRect(TransportDIB* dib,
diff --git a/chrome/browser/renderer_host/render_widget_host_view.h b/chrome/browser/renderer_host/render_widget_host_view.h
index 2c4a3dc..dca077e 100644
--- a/chrome/browser/renderer_host/render_widget_host_view.h
+++ b/chrome/browser/renderer_host/render_widget_host_view.h
@@ -151,6 +151,11 @@ class RenderWidgetHostView {
const std::vector<WebMenuItem>& items) = 0;
#endif
+#if defined(OS_LINUX)
+ virtual gfx::PluginWindowHandle CreatePluginContainer() = 0;
+ virtual void DestroyPluginContainer(gfx::PluginWindowHandle container) = 0;
+#endif
+
void set_activatable(bool activatable) {
activatable_ = activatable;
}
diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
index 1da195f..29d7275 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
@@ -34,7 +34,8 @@ using WebKit::WebInputEventFactory;
class RenderWidgetHostViewGtkWidget {
public:
static GtkWidget* CreateNewWidget(RenderWidgetHostViewGtk* host_view) {
- GtkWidget* widget = gtk_drawing_area_new();
+ GtkWidget* widget = gtk_fixed_new();
+ gtk_fixed_set_has_window(GTK_FIXED(widget), TRUE);
gtk_widget_set_double_buffered(widget, FALSE);
#if defined(NDEBUG)
gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, &gfx::kGdkWhite);
@@ -375,6 +376,7 @@ RenderWidgetHostViewGtk::~RenderWidgetHostViewGtk() {
void RenderWidgetHostViewGtk::InitAsChild() {
view_.Own(RenderWidgetHostViewGtkWidget::CreateNewWidget(this));
+ plugin_container_manager_.set_host_widget(view_.get());
gtk_widget_show(view_.get());
}
@@ -384,6 +386,7 @@ void RenderWidgetHostViewGtk::InitAsPopup(
parent_ = parent_host_view->GetNativeView();
GtkWidget* popup = gtk_window_new(GTK_WINDOW_POPUP);
view_.Own(RenderWidgetHostViewGtkWidget::CreateNewWidget(this));
+ plugin_container_manager_.set_host_widget(view_.get());
gtk_container_add(GTK_CONTAINER(popup), view_.get());
// If we are not activatable, we don't want to grab keyboard input,
@@ -471,10 +474,9 @@ gfx::NativeView RenderWidgetHostViewGtk::GetNativeView() {
void RenderWidgetHostViewGtk::MovePluginWindows(
const std::vector<WebPluginGeometry>& plugin_window_moves) {
- if (plugin_window_moves.empty())
- return;
-
- NOTIMPLEMENTED();
+ for (size_t i = 0; i < plugin_window_moves.size(); ++i) {
+ plugin_container_manager_.MovePluginContainer(plugin_window_moves[i]);
+ }
}
void RenderWidgetHostViewGtk::Focus() {
@@ -573,6 +575,7 @@ void RenderWidgetHostViewGtk::DidScrollRect(const gfx::Rect& rect, int dx,
void RenderWidgetHostViewGtk::RenderViewGone() {
Destroy();
+ plugin_container_manager_.set_host_widget(NULL);
}
void RenderWidgetHostViewGtk::Destroy() {
@@ -707,3 +710,12 @@ void RenderWidgetHostViewGtk::ReceivedSelectionText(GtkClipboard* clipboard,
host_view->host_->Send(new ViewMsg_InsertText(host_view->host_->routing_id(),
UTF8ToUTF16(text)));
}
+
+gfx::PluginWindowHandle RenderWidgetHostViewGtk::CreatePluginContainer() {
+ return plugin_container_manager_.CreatePluginContainer();
+}
+
+void RenderWidgetHostViewGtk::DestroyPluginContainer(
+ gfx::PluginWindowHandle container) {
+ plugin_container_manager_.DestroyPluginContainer(container);
+}
diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.h b/chrome/browser/renderer_host/render_widget_host_view_gtk.h
index 3df3006..1caa1ac 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_gtk.h
+++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.h
@@ -12,6 +12,7 @@
#include "chrome/browser/renderer_host/render_widget_host_view.h"
#include "chrome/common/owned_widget_gtk.h"
#include "chrome/common/render_messages.h"
+#include "webkit/glue/plugins/gtk_plugin_container_manager.h"
#include "webkit/glue/webcursor.h"
class RenderWidgetHost;
@@ -59,6 +60,8 @@ class RenderWidgetHostViewGtk : public RenderWidgetHostView {
virtual void PasteFromSelectionClipboard();
virtual void ShowingContextMenu(bool showing);
virtual BackingStore* AllocBackingStore(const gfx::Size& size);
+ virtual gfx::PluginWindowHandle CreatePluginContainer();
+ virtual void DestroyPluginContainer(gfx::PluginWindowHandle container);
gfx::NativeView native_view() const { return view_.get(); }
@@ -137,6 +140,9 @@ class RenderWidgetHostViewGtk : public RenderWidgetHostView {
// This state is used when GtkIMContext signal handlers create Char events
// because they don't use the GdkEventKey objects and cannot get the state.
int im_modifier_state_;
+
+ // Helper class that lets us allocate plugin containers and move them.
+ GtkPluginContainerManager plugin_container_manager_;
};
#endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_
diff --git a/chrome/browser/renderer_host/test/test_render_view_host.h b/chrome/browser/renderer_host/test/test_render_view_host.h
index d87ce14..0b16181 100644
--- a/chrome/browser/renderer_host/test/test_render_view_host.h
+++ b/chrome/browser/renderer_host/test/test_render_view_host.h
@@ -79,6 +79,11 @@ class TestRenderWidgetHostView : public RenderWidgetHostView {
const std::vector<WebMenuItem>& items) {}
#endif
+#if defined(OS_LINUX)
+ virtual gfx::PluginWindowHandle CreatePluginContainer() { return 0; }
+ virtual void DestroyPluginContainer(gfx::PluginWindowHandle container) { }
+#endif
+
bool is_showing() const { return is_showing_; }
private:
diff --git a/chrome/common/plugin_messages_internal.h b/chrome/common/plugin_messages_internal.h
index 9eed897..dc853c2 100644
--- a/chrome/common/plugin_messages_internal.h
+++ b/chrome/common/plugin_messages_internal.h
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/gfx/native_widget_types.h"
#include "base/shared_memory.h"
#include "build/build_config.h"
#include "chrome/common/ipc_message_macros.h"
@@ -97,6 +98,16 @@ IPC_BEGIN_MESSAGES(PluginProcessHost)
HWND /* caller window */)
#endif
+#if defined(OS_LINUX)
+ // On Linux, the mapping between NativeViewId and X window ids
+ // is known only to the browser. This message lets the plugin process
+ // ask about a NativeViewId that was provided by the renderer.
+ // It will get 0 back if it's a bogus input.
+ IPC_SYNC_MESSAGE_CONTROL1_1(PluginProcessHostMsg_MapNativeViewId,
+ gfx::NativeViewId /* input: native view id */,
+ gfx::PluginWindowHandle /* output: X window id */)
+#endif
+
IPC_END_MESSAGES(PluginProcessHost)
@@ -219,7 +230,16 @@ IPC_BEGIN_MESSAGES(PluginHost)
// The window parameter is a handle to the window if the plugin is a windowed
// plugin. It is NULL for windowless plugins.
IPC_SYNC_MESSAGE_ROUTED1_0(PluginHostMsg_SetWindow,
- gfx::NativeViewId /* window */)
+ gfx::PluginWindowHandle /* window */)
+
+#if defined(OS_LINUX)
+ // Asks the renderer to create a plugin container (GtkSocket).
+ IPC_SYNC_MESSAGE_ROUTED0_1(PluginHostMsg_CreatePluginContainer,
+ gfx::PluginWindowHandle /* container */)
+ // Asks the renderer to destroy a plugin container (GtkSocket).
+ IPC_SYNC_MESSAGE_ROUTED1_0(PluginHostMsg_DestroyPluginContainer,
+ gfx::PluginWindowHandle /* container */)
+#endif
#if defined(OS_WIN)
// The modal_loop_pump_messages_event parameter is an event handle which is
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index d04c3a5..d6ff653 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -929,6 +929,13 @@ IPC_BEGIN_MESSAGES(ViewHost)
IPC::ChannelHandle /* handle to channel */,
FilePath /* plugin_path */)
+#if defined(OS_LINUX)
+ IPC_SYNC_MESSAGE_ROUTED0_1(ViewHostMsg_CreatePluginContainer,
+ gfx::PluginWindowHandle /* container */)
+ IPC_SYNC_MESSAGE_ROUTED1_0(ViewHostMsg_DestroyPluginContainer,
+ gfx::PluginWindowHandle /* container */)
+#endif
+
// Clipboard IPC messages
// This message is used when the object list does not contain a bitmap.
diff --git a/chrome/plugin/plugin_main.cc b/chrome/plugin/plugin_main.cc
index fb8880f..a710b70 100644
--- a/chrome/plugin/plugin_main.cc
+++ b/chrome/plugin/plugin_main.cc
@@ -67,6 +67,22 @@ int PluginMain(const MainFunctionParams& parameters) {
MB_OK | MB_SETFOREGROUND);
}
#else
+#if defined(OS_LINUX)
+ {
+ // XEmbed plugins assume they are hosted in a Gtk application, so we need
+ // to initialize Gtk in the plugin process.
+ // TODO(evanm): hoist this up nearer to where we have argc/argv.
+ const std::vector<std::string>& args = parameters.command_line_.argv();
+ int argc = args.size();
+ scoped_array<const char *> argv(new const char *[argc + 1]);
+ for (int i = 0; i < argc; ++i) {
+ argv[i] = args[i].c_str();
+ }
+ argv[argc] = NULL;
+ const char **argv_pointer = argv.get();
+ gtk_init(&argc, const_cast<char***>(&argv_pointer));
+ }
+#endif
NOTIMPLEMENTED() << " non-windows startup, plugin startup dialog etc.";
#endif
diff --git a/chrome/plugin/webplugin_delegate_stub.cc b/chrome/plugin/webplugin_delegate_stub.cc
index e607667..3bfd002 100644
--- a/chrome/plugin/webplugin_delegate_stub.cc
+++ b/chrome/plugin/webplugin_delegate_stub.cc
@@ -128,14 +128,15 @@ void WebPluginDelegateStub::OnInit(const PluginMsg_Init_Params& params,
FilePath path = FilePath::FromWStringHack(
command_line.GetSwitchValue(switches::kPluginPath));
+
+ gfx::PluginWindowHandle parent = NULL;
#if defined(OS_WIN)
- delegate_ = WebPluginDelegate::Create(
- path, mime_type_, gfx::NativeViewFromId(params.containing_window));
-#else
- NOTIMPLEMENTED() << " need to figure out nativeview id business";
- delegate_ = WebPluginDelegate::Create(
- path, mime_type_, NULL);
+ parent = gfx::NativeViewFromId(params.containing_window);
+#elif defined(OS_LINUX)
+ PluginThread::current()->Send(new PluginProcessHostMsg_MapNativeViewId(
+ params.containing_window, &parent));
#endif
+ delegate_ = WebPluginDelegate::Create(path, mime_type_, parent);
if (delegate_) {
webplugin_ = new WebPluginProxy(channel_, instance_id_, delegate_);
diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc
index 57c07fc..3d6a6ac 100644
--- a/chrome/plugin/webplugin_proxy.cc
+++ b/chrome/plugin/webplugin_proxy.cc
@@ -56,12 +56,16 @@ bool WebPluginProxy::Send(IPC::Message* msg) {
return channel_->Send(msg);
}
-void WebPluginProxy::SetWindow(gfx::PluginWindowHandle window) {
-#if defined(OS_WIN)
- Send(new PluginHostMsg_SetWindow(route_id_, gfx::IdFromNativeView(window)));
-#else
- NOTIMPLEMENTED();
+#if defined(OS_LINUX)
+gfx::PluginWindowHandle WebPluginProxy::CreatePluginContainer() {
+ gfx::PluginWindowHandle container;
+ Send(new PluginHostMsg_CreatePluginContainer(route_id_, &container));
+ return container;
+}
#endif
+
+void WebPluginProxy::SetWindow(gfx::PluginWindowHandle window) {
+ Send(new PluginHostMsg_SetWindow(route_id_, window));
}
void WebPluginProxy::WillDestroyWindow(gfx::PluginWindowHandle window) {
@@ -69,6 +73,8 @@ void WebPluginProxy::WillDestroyWindow(gfx::PluginWindowHandle window) {
PluginThread::current()->Send(
new PluginProcessHostMsg_PluginWindowDestroyed(
window, ::GetParent(window)));
+#elif defined(OS_LINUX)
+ Send(new PluginHostMsg_DestroyPluginContainer(route_id_, window));
#else
NOTIMPLEMENTED();
#endif
@@ -275,7 +281,6 @@ void WebPluginProxy::HandleURLRequest(const char *method,
if (!target && (0 == base::strcasecmp(method, "GET"))) {
// Please refer to https://bugzilla.mozilla.org/show_bug.cgi?id=366082
// for more details on this.
-#if defined(OS_WIN)
if (delegate_->GetQuirks() &
WebPluginDelegate::PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS) {
GURL request_url(url);
@@ -285,10 +290,6 @@ void WebPluginProxy::HandleURLRequest(const char *method,
return;
}
}
-#else
- // TODO(port): we need a GetQuirks() on our delegate impl.
- NOTIMPLEMENTED();
-#endif
}
PluginHostMsg_URLRequest_Params params;
@@ -402,7 +403,6 @@ void WebPluginProxy::UpdateGeometry(
const gfx::Rect& clip_rect,
const TransportDIB::Id& windowless_buffer_id,
const TransportDIB::Id& background_buffer_id) {
-#if defined(OS_WIN)
// TODO(port): this isn't correct usage of a TransportDIB; for now,
// the caller temporarly just stuffs the handle into the HANDLE
// field of the TransportDIB::Id so it should behave like the older
@@ -410,8 +410,9 @@ void WebPluginProxy::UpdateGeometry(
gfx::Rect old = delegate_->GetRect();
gfx::Rect old_clip_rect = delegate_->GetClipRect();
- bool moved = old.x() != window_rect.x() || old.y() != window_rect.y();
delegate_->UpdateGeometry(window_rect, clip_rect);
+#if defined(OS_WIN)
+ bool moved = old.x() != window_rect.x() || old.y() != window_rect.y();
if (windowless_buffer_id.handle) {
// The plugin's rect changed, so now we have a new buffer to draw into.
SetWindowlessBuffer(windowless_buffer_id.handle,
diff --git a/chrome/plugin/webplugin_proxy.h b/chrome/plugin/webplugin_proxy.h
index c7bbe91..0388514 100644
--- a/chrome/plugin/webplugin_proxy.h
+++ b/chrome/plugin/webplugin_proxy.h
@@ -38,9 +38,7 @@ class WebPluginProxy : public WebPlugin {
// WebPlugin overrides
#if defined(OS_LINUX)
- gfx::PluginWindowHandle CreatePluginContainer() {
- return 0; // Temporary empty stub while we restructure test_shell.
- }
+ gfx::PluginWindowHandle CreatePluginContainer();
#endif
void SetWindow(gfx::PluginWindowHandle window);
void WillDestroyWindow(gfx::PluginWindowHandle window);
diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc
index b98b728..37012b8 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 != static_cast<gfx::PluginWindowHandle>(0);
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