summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/gfx/native_widget_types.h13
-rw-r--r--chrome/common/ipc_message_utils.h19
-rw-r--r--chrome/plugin/webplugin_proxy.cc10
-rw-r--r--chrome/plugin/webplugin_proxy.h4
-rw-r--r--webkit/glue/plugins/gtk_plugin_container.cc16
-rw-r--r--webkit/glue/plugins/plugin_host.cc2
-rw-r--r--webkit/glue/plugins/plugin_instance.h8
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl.cc4
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl.h6
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl_gtk.cc55
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl_mac.mm7
-rw-r--r--webkit/glue/webplugin.h8
-rw-r--r--webkit/glue/webplugin_delegate.h5
-rw-r--r--webkit/glue/webplugin_impl.cc2
-rw-r--r--webkit/glue/webplugin_impl.h6
-rw-r--r--webkit/tools/test_shell/test_webview_delegate_gtk.cc39
-rw-r--r--webkit/tools/test_shell/webview_host.h30
-rw-r--r--webkit/tools/test_shell/webview_host_gtk.cc37
18 files changed, 91 insertions, 180 deletions
diff --git a/base/gfx/native_widget_types.h b/base/gfx/native_widget_types.h
index aae9732..9444a61 100644
--- a/base/gfx/native_widget_types.h
+++ b/base/gfx/native_widget_types.h
@@ -114,19 +114,6 @@ static inline NativeViewId IdFromNativeView(NativeView view) {
NativeViewId IdFromNativeView(NativeView view);
#endif // defined(OS_LINUX)
-
-// PluginWindowHandle is an abstraction wrapping "the types of windows
-// used by NPAPI plugins". On Windows it's an HWND, on X it's an X
-// window id.
-#if defined(OS_WIN)
- typedef HWND PluginWindowHandle;
-#elif defined(OS_LINUX)
- typedef unsigned long PluginWindowHandle;
-#else
- // On OS X we don't have windowed plugins.
- typedef gfx::NativeView PluginWindowHandle;
-#endif
-
} // namespace gfx
#endif // BASE_GFX_NATIVE_WIDGET_TYPES_H_
diff --git a/chrome/common/ipc_message_utils.h b/chrome/common/ipc_message_utils.h
index 8c50d6e..2ae2ab5 100644
--- a/chrome/common/ipc_message_utils.h
+++ b/chrome/common/ipc_message_utils.h
@@ -176,25 +176,6 @@ struct ParamTraits<long> {
}
};
-// unsigned long is used for serializing X window ids.
-template <>
-struct ParamTraits<unsigned long> {
- typedef unsigned long param_type;
- static void Write(Message* m, const param_type& p) {
- m->WriteLong(p);
- }
- static bool Read(const Message* m, void** iter, param_type* r) {
- long read_output;
- if (!m->ReadLong(iter, &read_output))
- return false;
- *r = static_cast<unsigned long>(read_output);
- return true;
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(StringPrintf(L"%ul", p));
- }
-};
-
template <>
struct ParamTraits<size_t> {
typedef size_t param_type;
diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc
index 57c07fc..286659b 100644
--- a/chrome/plugin/webplugin_proxy.cc
+++ b/chrome/plugin/webplugin_proxy.cc
@@ -56,21 +56,15 @@ bool WebPluginProxy::Send(IPC::Message* msg) {
return channel_->Send(msg);
}
-void WebPluginProxy::SetWindow(gfx::PluginWindowHandle window) {
-#if defined(OS_WIN)
+void WebPluginProxy::SetWindow(gfx::NativeView window) {
Send(new PluginHostMsg_SetWindow(route_id_, gfx::IdFromNativeView(window)));
-#else
- NOTIMPLEMENTED();
-#endif
}
-void WebPluginProxy::WillDestroyWindow(gfx::PluginWindowHandle window) {
+void WebPluginProxy::WillDestroyWindow(gfx::NativeView window) {
#if defined(OS_WIN)
PluginThread::current()->Send(
new PluginProcessHostMsg_PluginWindowDestroyed(
window, ::GetParent(window)));
-#else
- NOTIMPLEMENTED();
#endif
}
diff --git a/chrome/plugin/webplugin_proxy.h b/chrome/plugin/webplugin_proxy.h
index e143297..46c16d1 100644
--- a/chrome/plugin/webplugin_proxy.h
+++ b/chrome/plugin/webplugin_proxy.h
@@ -37,8 +37,8 @@ class WebPluginProxy : public WebPlugin {
~WebPluginProxy();
// WebPlugin overrides
- void SetWindow(gfx::PluginWindowHandle window);
- void WillDestroyWindow(gfx::PluginWindowHandle window);
+ void SetWindow(gfx::NativeView window);
+ void WillDestroyWindow(gfx::NativeView window);
#if defined(OS_WIN)
void SetWindowlessPumpEvent(HANDLE pump_messages_event);
// Returns true on success.
diff --git a/webkit/glue/plugins/gtk_plugin_container.cc b/webkit/glue/plugins/gtk_plugin_container.cc
index c487fa0..18bdb30 100644
--- a/webkit/glue/plugins/gtk_plugin_container.cc
+++ b/webkit/glue/plugins/gtk_plugin_container.cc
@@ -14,6 +14,13 @@ namespace {
// through GLib's object management.
class GtkPluginContainer : public GtkSocket {
public:
+ static GtkWidget* CreateNewWidget() {
+ GtkWidget* container = GTK_WIDGET(g_object_new(GetType(), NULL));
+ g_signal_connect(GTK_SOCKET(container), "plug-removed",
+ G_CALLBACK(OnPlugRemoved), NULL);
+ return container;
+ }
+
// Sets the requested size of the widget.
void set_size(int width, int height) {
width_ = width;
@@ -26,6 +33,7 @@ class GtkPluginContainer : public GtkSocket {
return G_TYPE_CHECK_INSTANCE_CAST(instance, GetType(), GtkPluginContainer);
}
+ private:
// Create and register our custom container type with GTK.
static GType GetType() {
static GType type = 0; // We only want to register our type once.
@@ -66,6 +74,12 @@ class GtkPluginContainer : public GtkSocket {
requisition->height = container->height_;
}
+ static gboolean OnPlugRemoved(GtkSocket* socket) {
+ // This is called when the other side of the socket goes away.
+ // We return TRUE to indicate that we don't want to destroy our side.
+ return TRUE;
+ }
+
int width_;
int height_;
DISALLOW_IMPLICIT_CONSTRUCTORS(GtkPluginContainer);
@@ -75,7 +89,7 @@ class GtkPluginContainer : public GtkSocket {
// Create a new instance of our GTK widget object.
GtkWidget* gtk_plugin_container_new() {
- return GTK_WIDGET(g_object_new(GtkPluginContainer::GetType(), NULL));
+ return GtkPluginContainer::CreateNewWidget();
}
void gtk_plugin_container_set_size(GtkWidget *widget, int width, int height) {
diff --git a/webkit/glue/plugins/plugin_host.cc b/webkit/glue/plugins/plugin_host.cc
index 2e1c233..815b415 100644
--- a/webkit/glue/plugins/plugin_host.cc
+++ b/webkit/glue/plugins/plugin_host.cc
@@ -711,7 +711,7 @@ NPError NPN_GetValue(NPP id, NPNVariable variable, void *value) {
{
#if defined(OS_WIN) || defined(OS_LINUX)
scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id);
- gfx::PluginWindowHandle handle = plugin->window_handle();
+ gfx::NativeView handle = plugin->window_handle();
*((void**)value) = (void*)handle;
rv = NPERR_NO_ERROR;
#else
diff --git a/webkit/glue/plugins/plugin_instance.h b/webkit/glue/plugins/plugin_instance.h
index ba8824f8..e73d49f 100644
--- a/webkit/glue/plugins/plugin_instance.h
+++ b/webkit/glue/plugins/plugin_instance.h
@@ -70,10 +70,8 @@ class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> {
NPP npp() { return npp_; }
// Get/Set for the instance's window handle.
- gfx::PluginWindowHandle window_handle() const { return window_handle_; }
- void set_window_handle(gfx::PluginWindowHandle value) {
- window_handle_ = value;
- }
+ gfx::NativeView window_handle() { return window_handle_; }
+ void set_window_handle(gfx::NativeView value) { window_handle_ = value; }
// Get/Set whether this instance is in Windowless mode.
// Default is false.
@@ -225,7 +223,7 @@ class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> {
scoped_refptr<PluginHost> host_;
NPPluginFuncs* npp_functions_;
std::vector<scoped_refptr<PluginStream> > open_streams_;
- gfx::PluginWindowHandle window_handle_;
+ gfx::NativeView window_handle_;
bool windowless_;
bool transparent_;
WebPlugin* webplugin_;
diff --git a/webkit/glue/plugins/webplugin_delegate_impl.cc b/webkit/glue/plugins/webplugin_delegate_impl.cc
index d197fb11..5cf00a5 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl.cc
+++ b/webkit/glue/plugins/webplugin_delegate_impl.cc
@@ -71,7 +71,7 @@ base::LazyInstance<iat_patch::IATPatchFunction> g_iat_patch_set_cursor(
WebPluginDelegate* WebPluginDelegate::Create(
const FilePath& filename,
const std::string& mime_type,
- gfx::PluginWindowHandle containing_view) {
+ gfx::NativeView containing_view) {
scoped_refptr<NPAPI::PluginLib> plugin =
NPAPI::PluginLib::CreatePluginLib(filename);
if (plugin.get() == NULL)
@@ -140,7 +140,7 @@ LRESULT CALLBACK WebPluginDelegateImpl::HandleEventMessageFilterHook(
}
WebPluginDelegateImpl::WebPluginDelegateImpl(
- gfx::PluginWindowHandle containing_view,
+ gfx::NativeView containing_view,
NPAPI::PluginInstance *instance)
: parent_(containing_view),
instance_(instance),
diff --git a/webkit/glue/plugins/webplugin_delegate_impl.h b/webkit/glue/plugins/webplugin_delegate_impl.h
index d3cbdbf..61a41cd 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl.h
+++ b/webkit/glue/plugins/webplugin_delegate_impl.h
@@ -91,7 +91,7 @@ class WebPluginDelegateImpl : public WebPluginDelegate {
private:
friend class DeleteTask<WebPluginDelegateImpl>;
- WebPluginDelegateImpl(gfx::PluginWindowHandle containing_view,
+ WebPluginDelegateImpl(gfx::NativeView containing_view,
NPAPI::PluginInstance *instance);
~WebPluginDelegateImpl();
@@ -154,7 +154,7 @@ class WebPluginDelegateImpl : public WebPluginDelegate {
void DestroyInstance();
// used for windowed plugins
- gfx::PluginWindowHandle windowed_handle_;
+ gfx::NativeView windowed_handle_;
bool windowed_did_set_window_;
#if defined(OS_WIN)
gfx::Rect windowed_last_pos_;
@@ -190,7 +190,7 @@ class WebPluginDelegateImpl : public WebPluginDelegate {
void EnsurePixmapAtLeastSize(int width, int height);
#endif
- gfx::PluginWindowHandle parent_;
+ gfx::NativeView parent_;
NPWindow window_;
#if defined(OS_MACOSX)
NP_CGContext cg_context_;
diff --git a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc
index 49670fc..f583876 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc
+++ b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc
@@ -38,7 +38,7 @@ using WebKit::WebMouseEvent;
WebPluginDelegate* WebPluginDelegate::Create(
const FilePath& filename,
const std::string& mime_type,
- gfx::PluginWindowHandle containing_view) {
+ gfx::NativeView containing_view) {
scoped_refptr<NPAPI::PluginLib> plugin =
NPAPI::PluginLib::CreatePluginLib(filename);
if (plugin.get() == NULL)
@@ -54,7 +54,7 @@ WebPluginDelegate* WebPluginDelegate::Create(
}
WebPluginDelegateImpl::WebPluginDelegateImpl(
- gfx::PluginWindowHandle containing_view,
+ gfx::NativeView containing_view,
NPAPI::PluginInstance *instance)
:
windowed_handle_(0),
@@ -263,40 +263,63 @@ bool WebPluginDelegateImpl::WindowedCreatePlugin() {
return false;
}
- window_.window = reinterpret_cast<void*>(parent_);
- // The remainder of the code expects windowed_handle_ to exist for
- // windowed mode, despite not actually ever reaching through
- // windowed_handle_. So let's set it to the one window handle we
- // actually have available.
- windowed_handle_ = parent_;
+ windowed_handle_ = gtk_plugin_container_new();
+ gtk_container_add(GTK_CONTAINER(parent_), windowed_handle_);
+ gtk_widget_show(windowed_handle_);
+ gtk_widget_realize(windowed_handle_);
+
+ window_.window = GINT_TO_POINTER(
+ gtk_socket_get_id(GTK_SOCKET(windowed_handle_)));
if (!window_.ws_info)
window_.ws_info = new NPSetWindowCallbackStruct;
NPSetWindowCallbackStruct* extra =
static_cast<NPSetWindowCallbackStruct*>(window_.ws_info);
- extra->display = GDK_DISPLAY();
- extra->visual = DefaultVisual(GDK_DISPLAY(), 0);
- extra->depth = DefaultDepth(GDK_DISPLAY(), 0);
- extra->colormap = DefaultColormap(GDK_DISPLAY(), 0);
+ extra->display = GDK_WINDOW_XDISPLAY(windowed_handle_->window);
+ GdkVisual* visual = gdk_drawable_get_visual(windowed_handle_->window);
+ extra->visual = GDK_VISUAL_XVISUAL(visual);
+ extra->depth = visual->depth;
+ extra->colormap = GDK_COLORMAP_XCOLORMAP(gdk_drawable_get_colormap(windowed_handle_->window));
return true;
}
void WebPluginDelegateImpl::WindowedDestroyWindow() {
- // We have no window to destroy; see comment in WindowedCreatePlugin
- // where windowed_handle_ is set.
- windowed_handle_ = 0;
+ if (windowed_handle_ != NULL) {
+ gtk_widget_destroy(windowed_handle_);
+ windowed_handle_ = NULL;
+ }
}
bool WebPluginDelegateImpl::WindowedReposition(
const gfx::Rect& window_rect,
const gfx::Rect& clip_rect) {
- if (window_rect == window_rect_ && clip_rect == clip_rect_)
+ if (!windowed_handle_) {
+ NOTREACHED();
+ return false;
+ }
+
+ if (window_rect_ == window_rect && clip_rect_ == clip_rect)
return false;
+ // We only set the plugin's size here. Its position is moved elsewhere, which
+ // allows the window moves/scrolling/clipping to be synchronized with the page
+ // and other windows.
+ if (window_rect.size() != window_rect_.size()) {
+ gtk_plugin_container_set_size(windowed_handle_, window_rect.width(),
+ window_rect.height());
+ GtkAllocation allocation = { 0, 0,
+ window_rect.width(), window_rect.height() };
+ gtk_widget_size_allocate(windowed_handle_, &allocation);
+ }
+
window_rect_ = window_rect;
clip_rect_ = clip_rect;
+ // TODO(deanm): Is this really needed?
+ // Ensure that the entire window gets repainted.
+ gtk_widget_queue_draw(windowed_handle_);
+
return true;
}
diff --git a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm
index 54bf43b..452410d 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm
+++ b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm
@@ -58,7 +58,7 @@ WebPluginDelegateImpl* g_current_plugin_instance = NULL;
WebPluginDelegate* WebPluginDelegate::Create(
const FilePath& filename,
const std::string& mime_type,
- gfx::NativeView containing_view) {
+ gfx::PluginWindowHandle containing_view) {
scoped_refptr<NPAPI::PluginLib> plugin =
NPAPI::PluginLib::CreatePluginLib(filename);
if (plugin.get() == NULL)
@@ -73,12 +73,13 @@ WebPluginDelegate* WebPluginDelegate::Create(
return new WebPluginDelegateImpl(containing_view, instance.get());
}
-bool WebPluginDelegateImpl::IsPluginDelegateWindow(gfx::NativeWindow window) {
+bool WebPluginDelegateImpl::IsPluginDelegateWindow(
+ gfx::PluginNativeView window) {
return false;
}
bool WebPluginDelegateImpl::GetPluginNameFromWindow(
- gfx::NativeWindow window, std::wstring *plugin_name) {
+ gfx::PluginNativeView window, std::wstring *plugin_name) {
if (NULL == plugin_name) {
return false;
}
diff --git a/webkit/glue/webplugin.h b/webkit/glue/webplugin.h
index 2debf9a..d6a5b75 100644
--- a/webkit/glue/webplugin.h
+++ b/webkit/glue/webplugin.h
@@ -25,9 +25,7 @@ struct NPObject;
// Describes the new location for a plugin window.
struct WebPluginGeometry {
- // On Windows, this is the plugin window in the plugin process.
- // On X11, this is the browser process's hosting window (the GtkSocket).
- gfx::PluginWindowHandle window;
+ gfx::NativeView window;
gfx::Rect window_rect;
// Clip rect (include) and cutouts (excludes), relative to
// window_rect origin.
@@ -56,11 +54,11 @@ class WebPlugin {
// windowed (i.e. handle is not NULL) or windowless (handle is NULL). This
// tells the WebPlugin to send mouse/keyboard events to the plugin delegate,
// as well as the information about the HDC for paint operations.
- virtual void SetWindow(gfx::PluginWindowHandle window) = 0;
+ virtual void SetWindow(gfx::NativeView window) = 0;
// Called by the plugin delegate to let it know that the window is being
// destroyed.
- virtual void WillDestroyWindow(gfx::PluginWindowHandle window) = 0;
+ virtual void WillDestroyWindow(gfx::NativeView window) = 0;
#if defined(OS_WIN)
// The pump_messages_event is a event handle which is valid only for
// windowless plugins and is used in NPP_HandleEvent calls to pump messages
diff --git a/webkit/glue/webplugin_delegate.h b/webkit/glue/webplugin_delegate.h
index 7d0fa88..385044d 100644
--- a/webkit/glue/webplugin_delegate.h
+++ b/webkit/glue/webplugin_delegate.h
@@ -8,9 +8,10 @@
#include <string>
#include "base/gfx/native_widget_types.h"
-#include "build/build_config.h"
#include "third_party/npapi/bindings/npapi.h"
+// TODO(port): put in OS_WIN check.
+typedef struct HDC__* HDC;
struct NPObject;
class FilePath;
@@ -47,7 +48,7 @@ class WebPluginDelegate {
static WebPluginDelegate* Create(const FilePath& filename,
const std::string& mime_type,
- gfx::PluginWindowHandle containing_view);
+ gfx::NativeView containing_view);
// Initializes the plugin implementation with the given (UTF8) arguments.
// Note that the lifetime of WebPlugin must be longer than this delegate.
diff --git a/webkit/glue/webplugin_impl.cc b/webkit/glue/webplugin_impl.cc
index 69f6259..d3c8d6a 100644
--- a/webkit/glue/webplugin_impl.cc
+++ b/webkit/glue/webplugin_impl.cc
@@ -388,7 +388,7 @@ WebPluginImpl::WebPluginImpl(WebCore::HTMLPlugInElement* element,
WebPluginImpl::~WebPluginImpl() {
}
-void WebPluginImpl::SetWindow(gfx::PluginWindowHandle window) {
+void WebPluginImpl::SetWindow(gfx::NativeView window) {
if (window) {
DCHECK(!windowless_); // Make sure not called twice.
window_ = window;
diff --git a/webkit/glue/webplugin_impl.h b/webkit/glue/webplugin_impl.h
index 9082820..ab7ea8f 100644
--- a/webkit/glue/webplugin_impl.h
+++ b/webkit/glue/webplugin_impl.h
@@ -148,8 +148,8 @@ class WebPluginImpl : public WebPlugin,
int arg_count, char** arg_names, char** arg_values);
// WebPlugin implementation:
- void SetWindow(gfx::PluginWindowHandle window);
- void WillDestroyWindow(gfx::PluginWindowHandle window) { }
+ void SetWindow(gfx::NativeView window);
+ void WillDestroyWindow(gfx::NativeView window) { }
#if defined(OS_WIN)
void SetWindowlessPumpEvent(HANDLE pump_messages_event) { }
#endif
@@ -333,7 +333,7 @@ class WebPluginImpl : public WebPlugin,
std::vector<ClientInfo> clients_;
bool windowless_;
- gfx::PluginWindowHandle window_;
+ gfx::NativeView window_;
WebCore::HTMLPlugInElement* element_;
WebFrameImpl* webframe_;
diff --git a/webkit/tools/test_shell/test_webview_delegate_gtk.cc b/webkit/tools/test_shell/test_webview_delegate_gtk.cc
index 74586e5..d4a0574 100644
--- a/webkit/tools/test_shell/test_webview_delegate_gtk.cc
+++ b/webkit/tools/test_shell/test_webview_delegate_gtk.cc
@@ -22,7 +22,6 @@
#include "webkit/glue/webplugin.h"
#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/webview.h"
-#include "webkit/glue/plugins/gtk_plugin_container.h"
#include "webkit/glue/plugins/plugin_list.h"
#include "webkit/glue/window_open_disposition.h"
#include "webkit/glue/plugins/webplugin_delegate_impl.h"
@@ -88,14 +87,12 @@ WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate(
actual_mime_type))
return NULL;
- const std::string& mtype =
- (actual_mime_type && !actual_mime_type->empty()) ? *actual_mime_type
- : mime_type;
-
- GdkNativeWindow plugin_parent =
- shell_->webViewHost()->CreatePluginContainer();
-
- return WebPluginDelegateImpl::Create(info.path, mtype, plugin_parent);
+ if (actual_mime_type && !actual_mime_type->empty())
+ return WebPluginDelegateImpl::Create(info.path, *actual_mime_type,
+ shell_->webViewHost()->view_handle());
+ else
+ return WebPluginDelegateImpl::Create(info.path, mime_type,
+ shell_->webViewHost()->view_handle());
}
void TestWebViewDelegate::ShowJavaScriptAlert(const std::wstring& message) {
@@ -219,24 +216,11 @@ void TestWebViewDelegate::GetRootWindowResizerRect(WebWidget* webwidget,
void TestWebViewDelegate::DidMove(WebWidget* webwidget,
const WebPluginGeometry& move) {
- WebWidgetHost* host = GetHostForWidget(webwidget);
-
- // The "window" on WebPluginGeometry is actually the XEmbed parent
- // X window id.
- GtkWidget* widget = ((WebViewHost*)host)->MapIDToWidget(move.window);
- // If we don't know about this plugin (maybe we're shutting down the
- // window?), ignore the message.
- if (!widget)
- return;
+ // The window on WebPluginGeometry is misnamed, as it's a view. In our case
+ // it should be the GtkSocket of the plugin window.
+ GtkWidget* widget = move.window;
DCHECK(!GTK_WIDGET_NO_WINDOW(widget) && GTK_WIDGET_REALIZED(widget));
- if (!move.visible) {
- gtk_widget_hide(widget);
- return;
- } else {
- gtk_widget_show(widget);
- }
-
// Update the clipping region on the GdkWindow.
GdkRectangle clip_rect = move.clip_rect.ToGdkRectangle();
GdkRegion* clip_region = gdk_region_rectangle(&clip_rect);
@@ -248,6 +232,7 @@ void TestWebViewDelegate::DidMove(WebWidget* webwidget,
// TODO(deanm): Verify that we only need to move and not resize.
// TODO(evanm): we should cache the last shape and position and skip all
// of this business in the common case where nothing has changed.
+ WebWidgetHost* host = GetHostForWidget(webwidget);
int current_x, current_y;
// Until the above TODO is resolved, we can grab the last position
@@ -270,10 +255,6 @@ void TestWebViewDelegate::DidMove(WebWidget* webwidget,
move.window_rect.x(),
move.window_rect.y());
}
-
- gtk_plugin_container_set_size(widget,
- move.window_rect.width(),
- move.window_rect.height());
}
void TestWebViewDelegate::RunModal(WebWidget* webwidget) {
diff --git a/webkit/tools/test_shell/webview_host.h b/webkit/tools/test_shell/webview_host.h
index 0cd62ee..337a355 100644
--- a/webkit/tools/test_shell/webview_host.h
+++ b/webkit/tools/test_shell/webview_host.h
@@ -5,8 +5,6 @@
#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"
@@ -16,10 +14,6 @@ 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:
@@ -32,36 +26,12 @@ 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_
diff --git a/webkit/tools/test_shell/webview_host_gtk.cc b/webkit/tools/test_shell/webview_host_gtk.cc
index cd491af..54e3ec8 100644
--- a/webkit/tools/test_shell/webview_host_gtk.cc
+++ b/webkit/tools/test_shell/webview_host_gtk.cc
@@ -6,11 +6,9 @@
#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
@@ -31,38 +29,3 @@ 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.
-}
-