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 54e3ec879618a34c79d66b41df7287a7323f19b3..cd491aff868a86c6f279c08b34f13dfaa172b57d 100644 |
--- a/webkit/tools/test_shell/webview_host_gtk.cc |
+++ b/webkit/tools/test_shell/webview_host_gtk.cc |
@@ -6,9 +6,11 @@ |
#include "webkit/tools/test_shell/webview_host.h" |
+#include "base/logging.h" |
#include "base/gfx/rect.h" |
#include "base/gfx/size.h" |
#include "skia/ext/platform_canvas.h" |
+#include "webkit/glue/plugins/gtk_plugin_container.h" |
#include "webkit/glue/webview.h" |
// static |
@@ -29,3 +31,38 @@ WebViewHost* WebViewHost::Create(GtkWidget* parent_view, |
WebView* WebViewHost::webview() const { |
return static_cast<WebView*>(webwidget_); |
} |
+ |
+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; |
+} |
+ |
+gboolean WebViewHost::OnPlugRemoved(GtkSocket* socket) { |
+ // Remove the socket's id from our list of widgets. |
+ GdkNativeWindow id = gtk_socket_get_id(socket); |
+ native_window_to_widget_map_.erase(id); |
+ |
+ return FALSE; // Destroy our widget. |
+} |
+ |