Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1438)

Unified Diff: webkit/tools/test_shell/webview_host_gtk.cc

Issue 146009: linux plugins: eliminate GtkWidget* from plugin process (Closed)
Patch Set: retry Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/tools/test_shell/webview_host.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
+}
+
« no previous file with comments | « webkit/tools/test_shell/webview_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698