summaryrefslogtreecommitdiffstats
path: root/webkit/tools/test_shell/webview_host.h
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-26 00:33:37 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-26 00:33:37 +0000
commit3b33faae96e4cf42ec6b0da5163668b1e482d821 (patch)
tree05bc5e540fdd3150cdc256d46b0602df0670c441 /webkit/tools/test_shell/webview_host.h
parent5f1b0d6b9fb0b529202c63e99a67032cf1a306c9 (diff)
downloadchromium_src-3b33faae96e4cf42ec6b0da5163668b1e482d821.zip
chromium_src-3b33faae96e4cf42ec6b0da5163668b1e482d821.tar.gz
chromium_src-3b33faae96e4cf42ec6b0da5163668b1e482d821.tar.bz2
linux plugins: eliminate GtkWidget* from plugin process
GtkWidget* (and its wrapper, gfx::NativeView) only work within a single process. Plugins already work with a lower-level type that works across processes -- an X Window id. The parent of a plugin is an HWND on windows, but it's an X Window id on X. So we introduce a new typedef wrapping that and push it through all the places in the code that needs it. Since we no longer have a GtkSocket in the WebPluginDelegateImpl, we need to do a bit more work in the WebViewDelegate (aka the browser process in the multiproc world). We also need the plugin host (the browser) to track the GtkSockets that are hosting the plugin, as well as destroy them when necessary. To do this we require the plugin owner to grab the plug-removed signal rather than putting its handler in GtkPluginContainer; this is the way it worked before I'd refactored into GtkPluginContainer so it shouldn't be so bad. This change still only works in test_shell, but the refactoring should translate to the multiprocess case pretty easily. Review URL: http://codereview.chromium.org/146009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19320 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/test_shell/webview_host.h')
-rw-r--r--webkit/tools/test_shell/webview_host.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/webkit/tools/test_shell/webview_host.h b/webkit/tools/test_shell/webview_host.h
index 337a355..0cd62ee 100644
--- a/webkit/tools/test_shell/webview_host.h
+++ b/webkit/tools/test_shell/webview_host.h
@@ -5,6 +5,8 @@
#ifndef WEBKIT_TOOLS_TEST_SHELL_WEBVIEW_HOST_H_
#define WEBKIT_TOOLS_TEST_SHELL_WEBVIEW_HOST_H_
+#include <map>
+
#include "base/basictypes.h"
#include "base/gfx/native_widget_types.h"
#include "base/gfx/rect.h"
@@ -14,6 +16,10 @@ struct WebPreferences;
class WebView;
class WebViewDelegate;
+#if defined(OS_LINUX)
+typedef struct _GtkSocket GtkSocket;
+#endif
+
// This class is a simple NativeView-based host for a WebView
class WebViewHost : public WebWidgetHost {
public:
@@ -26,12 +32,36 @@ class WebViewHost : public WebWidgetHost {
WebView* webview() const;
+#if defined(OS_LINUX)
+ // Create a new plugin parent container, returning its X window id for
+ // embedders to use.
+ GdkNativeWindow CreatePluginContainer();
+
+ // Map a GdkNativeWindow returned by CreatePluginContainer() back to
+ // the GtkWidget hosting it. Used when we get a message back from the
+ // renderer indicating a plugin needs to move.
+ GtkWidget* MapIDToWidget(GdkNativeWindow id);
+#endif
+
protected:
#if defined(OS_WIN)
virtual bool WndProc(UINT message, WPARAM wparam, LPARAM lparam) {
return false;
}
#endif
+
+#if defined(OS_LINUX)
+ // A map used for MapIDToWidget() above.
+ typedef std::map<GdkNativeWindow, GtkWidget*> NativeWindowToWidgetMap;
+ NativeWindowToWidgetMap native_window_to_widget_map_;
+
+ // Callback for when one of our plugins goes away.
+ static gboolean OnPlugRemovedThunk(GtkSocket* socket,
+ WebViewHost* web_view_host) {
+ return web_view_host->OnPlugRemoved(socket);
+ }
+ gboolean OnPlugRemoved(GtkSocket* socket);
+#endif
};
#endif // WEBKIT_TOOLS_TEST_SHELL_WEBVIEW_HOST_H_