summaryrefslogtreecommitdiffstats
path: root/webkit/tools/test_shell/webview_host_gtk.cc
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-07 17:40:46 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-07 17:40:46 +0000
commit700d3d58213d15dea1beb2f7f7122e77e7ea2a47 (patch)
tree5d6a3c72fa58cccd7a7f7ddba5c77ed0edbe5135 /webkit/tools/test_shell/webview_host_gtk.cc
parentd1ae85447a12e97b0758b0d113a12e2d6c6d09b4 (diff)
downloadchromium_src-700d3d58213d15dea1beb2f7f7122e77e7ea2a47.zip
chromium_src-700d3d58213d15dea1beb2f7f7122e77e7ea2a47.tar.gz
chromium_src-700d3d58213d15dea1beb2f7f7122e77e7ea2a47.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 refactor it, but I'm not sure where the common part should live. Patch from Antoine Labour <piman@google.com>, 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
Diffstat (limited to 'webkit/tools/test_shell/webview_host_gtk.cc')
-rw-r--r--webkit/tools/test_shell/webview_host_gtk.cc37
1 files changed, 3 insertions, 34 deletions
diff --git a/webkit/tools/test_shell/webview_host_gtk.cc b/webkit/tools/test_shell/webview_host_gtk.cc
index e089052..53c42d9 100644
--- a/webkit/tools/test_shell/webview_host_gtk.cc
+++ b/webkit/tools/test_shell/webview_host_gtk.cc
@@ -20,6 +20,7 @@ WebViewHost* WebViewHost::Create(GtkWidget* parent_view,
WebViewHost* host = new WebViewHost();
host->view_ = WebWidgetHost::CreateWidget(parent_view, host);
+ host->plugin_container_manager_.set_host_widget(host->view_);
g_object_set_data(G_OBJECT(host->view_), "webwidgethost", host);
host->webwidget_ = WebView::Create(delegate, prefs);
@@ -33,41 +34,9 @@ WebView* WebViewHost::webview() const {
}
GdkNativeWindow WebViewHost::CreatePluginContainer() {
- GtkWidget* plugin_container = gtk_plugin_container_new();
- g_signal_connect(G_OBJECT(plugin_container), "plug-removed",
- G_CALLBACK(OnPlugRemovedThunk), this);
- gtk_container_add(GTK_CONTAINER(view_handle()), plugin_container);
- gtk_widget_show(plugin_container);
- gtk_widget_realize(plugin_container);
-
- GdkNativeWindow id = gtk_socket_get_id(GTK_SOCKET(plugin_container));
-
- native_window_to_widget_map_.insert(std::make_pair(id, plugin_container));
-
- return id;
-}
-
-GtkWidget* WebViewHost::MapIDToWidget(GdkNativeWindow id) {
- NativeWindowToWidgetMap::const_iterator i =
- native_window_to_widget_map_.find(id);
- if (i != native_window_to_widget_map_.end())
- return i->second;
-
- LOG(ERROR) << "Request for widget host for unknown window id " << id;
-
- return NULL;
+ return plugin_container_manager_.CreatePluginContainer();
}
void WebViewHost::OnPluginWindowDestroyed(GdkNativeWindow id) {
- GtkWidget* plugin_container = MapIDToWidget(id);
- if (!plugin_container)
- return;
-
- native_window_to_widget_map_.erase(id);
- gtk_widget_destroy(plugin_container);
+ plugin_container_manager_.DestroyPluginContainer(id);
}
-
-gboolean WebViewHost::OnPlugRemoved(GtkSocket* socket) {
- return TRUE; // Don't destroy our widget; we manage it ourselves.
-}
-