summaryrefslogtreecommitdiffstats
path: root/chrome/plugin/webplugin_proxy.cc
diff options
context:
space:
mode:
authorpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-25 20:50:32 +0000
committerpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-25 20:50:32 +0000
commitc0478b0985b9893601125a88a32a648656a75948 (patch)
tree8af9f0dcb303cbcdbf0da4c134f025d4e7ddd238 /chrome/plugin/webplugin_proxy.cc
parentd4eb7120deddccf96ff85ecc393b0757497bb7d6 (diff)
downloadchromium_src-c0478b0985b9893601125a88a32a648656a75948.zip
chromium_src-c0478b0985b9893601125a88a32a648656a75948.tar.gz
chromium_src-c0478b0985b9893601125a88a32a648656a75948.tar.bz2
linux: new socket/plug code for windowed plugins
This CL reworks the GtkSocket/GtkPlug code for windowed plugins on linux. Instead of having the plugin ask the browser to create a socket to plug into, it simply creates a plug and sends it to the browser. The browser creates a socket and attaches the plug when the socket becomes realized This fixes 2 main issues: - we can create windowed plugins in background tabs (Issue 16125) - we can detach tabs with windowed plugins and reattach them (Issue 17110) I reworked the IPCs, so it removes some amount of linux-specific things. We also need less synchronous IPCs to create/destroy plugins, so that should be a bit faster. In particular, I removed the plugin pid map, and instead made sure the renderer always destroys the plugin containers if the plugin process crashes - they will be destroyed if the renderer process crashes. Let me know if you have an issue with that. Also, the intermediate plug/socket creation now happens in webplugin_delegate_impl_gtk. That means test_shell uses it as well. It made the code a lot simpler, and means we're testing it as well, albeit with a bit of extra overhead. Bonus: I found a big bad bug in the GtkPluginContainer that made its width/height alias with some internal gtk structures. That was certainly causing some amounts of bugs. Bonus 2: scrolling now looks more in sync with the rest of the page, though I'm not exactly sure which part caused that. BUG=16125,17110 TEST=a lot of manual testing involving YouTube videos Review URL: http://codereview.chromium.org/174295 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24309 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin/webplugin_proxy.cc')
-rw-r--r--chrome/plugin/webplugin_proxy.cc52
1 files changed, 1 insertions, 51 deletions
diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc
index 7d2598a..9a77484 100644
--- a/chrome/plugin/webplugin_proxy.cc
+++ b/chrome/plugin/webplugin_proxy.cc
@@ -5,9 +5,6 @@
#include "chrome/plugin/webplugin_proxy.h"
#include "build/build_config.h"
-#if defined(OS_LINUX)
-#include <gtk/gtk.h>
-#endif
#include "app/gfx/canvas.h"
#if defined(OS_WIN)
@@ -56,11 +53,6 @@ WebPluginProxy::WebPluginProxy(
delegate_(delegate),
waiting_for_paint_(false),
page_url_(page_url),
-#if defined(OS_LINUX)
- container_(0),
- plug_(NULL),
- socket_(NULL),
-#endif
ALLOW_THIS_IN_INITIALIZER_LIST(runnable_method_factory_(this))
{
}
@@ -74,42 +66,7 @@ bool WebPluginProxy::Send(IPC::Message* msg) {
return channel_->Send(msg);
}
-#if defined(OS_LINUX)
-gfx::PluginWindowHandle WebPluginProxy::CreatePluginContainer() {
- DCHECK(!container_);
- DCHECK(!plug_);
- DCHECK(!socket_);
-
- Send(new PluginHostMsg_CreatePluginContainer(route_id_, &container_));
- if (!container_)
- return 0;
-
- plug_ = gtk_plug_new(container_);
- gtk_widget_show(plug_);
- socket_ = gtk_socket_new();
- gtk_widget_show(socket_);
- gtk_container_add(GTK_CONTAINER(plug_), socket_);
- gtk_widget_show_all(plug_);
-
- // Prevent the plug from being destroyed if the browser kills the container
- // window.
- g_signal_connect(plug_, "delete-event", G_CALLBACK(gtk_true), NULL);
- // Prevent the socket from being destroyed when the plugin removes itself.
- g_signal_connect(socket_, "plug_removed", G_CALLBACK(gtk_true), NULL);
-
- return gtk_socket_get_id(GTK_SOCKET(socket_));
-}
-#endif
-
void WebPluginProxy::SetWindow(gfx::PluginWindowHandle window) {
-#if defined(OS_LINUX)
- if (window) {
- DCHECK(plug_);
- DCHECK(socket_);
- DCHECK_EQ(window, gtk_socket_get_id(GTK_SOCKET(socket_)));
- window = container_;
- }
-#endif
Send(new PluginHostMsg_SetWindow(route_id_, window));
}
@@ -119,14 +76,7 @@ void WebPluginProxy::WillDestroyWindow(gfx::PluginWindowHandle window) {
new PluginProcessHostMsg_PluginWindowDestroyed(
window, ::GetParent(window)));
#elif defined(OS_LINUX)
- DCHECK(plug_);
- DCHECK(socket_);
- DCHECK_EQ(window, gtk_socket_get_id(GTK_SOCKET(socket_)));
- Send(new PluginHostMsg_DestroyPluginContainer(route_id_, container_));
- gtk_widget_destroy(plug_);
- container_ = NULL;
- plug_ = NULL;
- socket_ = NULL;
+ // Nothing to do.
#else
NOTIMPLEMENTED();
#endif