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

Unified Diff: webkit/glue/plugins/webplugin_delegate_impl_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/glue/plugins/webplugin_delegate_impl.cc ('k') | webkit/glue/webplugin.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/plugins/webplugin_delegate_impl_gtk.cc
diff --git a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc
index f5838761657cd60e9c7bcd08cf62302fc50d8087..49670fc91a8178cf3bc44fdf7bdc13058a6e85e3 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::NativeView containing_view) {
+ gfx::PluginWindowHandle 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::NativeView containing_view,
+ gfx::PluginWindowHandle containing_view,
NPAPI::PluginInstance *instance)
:
windowed_handle_(0),
@@ -263,63 +263,40 @@ bool WebPluginDelegateImpl::WindowedCreatePlugin() {
return false;
}
- 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_)));
+ 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_;
if (!window_.ws_info)
window_.ws_info = new NPSetWindowCallbackStruct;
NPSetWindowCallbackStruct* extra =
static_cast<NPSetWindowCallbackStruct*>(window_.ws_info);
- 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));
+ extra->display = GDK_DISPLAY();
+ extra->visual = DefaultVisual(GDK_DISPLAY(), 0);
+ extra->depth = DefaultDepth(GDK_DISPLAY(), 0);
+ extra->colormap = DefaultColormap(GDK_DISPLAY(), 0);
return true;
}
void WebPluginDelegateImpl::WindowedDestroyWindow() {
- if (windowed_handle_ != NULL) {
- gtk_widget_destroy(windowed_handle_);
- windowed_handle_ = NULL;
- }
+ // We have no window to destroy; see comment in WindowedCreatePlugin
+ // where windowed_handle_ is set.
+ windowed_handle_ = 0;
}
bool WebPluginDelegateImpl::WindowedReposition(
const gfx::Rect& window_rect,
const gfx::Rect& clip_rect) {
- if (!windowed_handle_) {
- NOTREACHED();
- return false;
- }
-
- if (window_rect_ == window_rect && clip_rect_ == clip_rect)
+ 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;
}
« no previous file with comments | « webkit/glue/plugins/webplugin_delegate_impl.cc ('k') | webkit/glue/webplugin.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698