Chromium Code Reviews| Index: content/browser/web_contents/web_contents_view_gtk.cc |
| diff --git a/content/browser/web_contents/web_contents_view_gtk.cc b/content/browser/web_contents/web_contents_view_gtk.cc |
| index 7c6683530f4a60386332ae7a92a8d66f343a9ac6..a89a32faee7fb4be0cae441b984dde4de3ba37fc 100644 |
| --- a/content/browser/web_contents/web_contents_view_gtk.cc |
| +++ b/content/browser/web_contents/web_contents_view_gtk.cc |
| @@ -223,11 +223,20 @@ RenderWidgetHostView* WebContentsViewGtk::CreateViewForWidget( |
| GDK_POINTER_MOTION_MASK); |
| InsertIntoContentArea(content_view); |
| - // Renderer target DnD. |
| - drag_dest_.reset(new WebDragDestGtk(web_contents_, content_view)); |
| - |
| - if (delegate_.get()) |
| - drag_dest_->set_delegate(delegate_->GetDragDestDelegate()); |
| + if (render_widget_host->IsRenderView()) { |
| + RenderViewHost* rvh = RenderViewHost::From(render_widget_host); |
| + // According to WebContentsImpl::RenderViewCreated, if the RVH is swapped |
| + // out on creation then we are just creating a swapped-out RVH for the |
| + // opener chain that won't be used for WebUI, so it won't be expected to |
| + // receive any events. |
|
Charlie Reis
2013/02/27 01:42:35
This comment doesn't make sense to me. First, cre
mthiesse
2013/02/27 14:57:13
Done.
|
| + if (!static_cast<RenderViewHostImpl*>(rvh)->is_swapped_out()) { |
| + // Renderer target DnD. |
| + drag_dest_.reset(new WebDragDestGtk(web_contents_, content_view)); |
| + |
| + if (delegate_.get()) |
| + drag_dest_->set_delegate(delegate_->GetDragDestDelegate()); |
| + } |
| + } |
| return view; |
| } |
| @@ -262,7 +271,20 @@ void WebContentsViewGtk::SizeContents(const gfx::Size& size) { |
| void WebContentsViewGtk::RenderViewCreated(RenderViewHost* host) { |
| } |
| -void WebContentsViewGtk::RenderViewSwappedIn(RenderViewHost* host) { |
| +void WebContentsViewGtk::RenderViewSwappedIn(RenderViewHost* new_host, |
| + RenderViewHost* old_host) { |
|
Charlie Reis
2013/02/27 01:42:35
Shouldn't we update drag_dest_ every time we get h
mthiesse
2013/02/27 14:57:13
No, if we update the drag_dest_ every time here, j
Charlie Reis
2013/02/27 20:01:44
This sounds like an issue with drag n drop, which
|
| + // If we don't have a drag_dest yet, then we should set the drag test to the |
| + // new RVH. |
| + // Also, not sure if this ever happens, but if the renderViewHost we're |
| + // swapping out is used by the drag_dest, then we need to reset the drag_dest |
| + // to the new host. |
| + if (!drag_dest_.get() || (old_host && |
| + (old_host->GetView()->GetNativeView() == drag_dest_->widget()))) { |
| + drag_dest_.reset(new WebDragDestGtk(web_contents_, |
| + new_host->GetView()->GetNativeView())); |
| + if (delegate_.get()) |
| + drag_dest_->set_delegate(delegate_->GetDragDestDelegate()); |
| + } |
| } |
| WebContents* WebContentsViewGtk::web_contents() { |