Index: webkit/tools/test_shell/webview_host_gtk.cc |
diff --git a/webkit/tools/test_shell/webview_host_gtk.cc b/webkit/tools/test_shell/webview_host_gtk.cc |
index e089052df7bc1fc24121fe8e677cd24f5370d6f8..a2a76c6e3a5c0129343b7e45bbc5e83962dacb35 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_host_.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_host_.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_host_.DestroyPluginContainer(id); |
} |
- |
-gboolean WebViewHost::OnPlugRemoved(GtkSocket* socket) { |
- return TRUE; // Don't destroy our widget; we manage it ourselves. |
-} |
- |