| 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..d3b5a3e01c2870147a9a302e4ec98284dc3dd021 100644
|
| --- a/content/browser/web_contents/web_contents_view_gtk.cc
|
| +++ b/content/browser/web_contents/web_contents_view_gtk.cc
|
| @@ -223,11 +223,13 @@ 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());
|
| + // We don't want to change any state in this class for swapped out RVHs
|
| + // because they will not be visible at this time.
|
| + if (render_widget_host->IsRenderView()) {
|
| + RenderViewHost* rvh = RenderViewHost::From(render_widget_host);
|
| + if (!static_cast<RenderViewHostImpl*>(rvh)->is_swapped_out())
|
| + UpdateDragDest(rvh);
|
| + }
|
|
|
| return view;
|
| }
|
| @@ -263,6 +265,7 @@ void WebContentsViewGtk::RenderViewCreated(RenderViewHost* host) {
|
| }
|
|
|
| void WebContentsViewGtk::RenderViewSwappedIn(RenderViewHost* host) {
|
| + UpdateDragDest(host);
|
| }
|
|
|
| WebContents* WebContentsViewGtk::web_contents() {
|
| @@ -294,6 +297,24 @@ void WebContentsViewGtk::InsertIntoContentArea(GtkWidget* widget) {
|
| gtk_container_add(GTK_CONTAINER(expanded_.get()), widget);
|
| }
|
|
|
| +void WebContentsViewGtk::UpdateDragDest(RenderViewHost* host) {
|
| + gfx::NativeView content_view = host->GetView()->GetNativeView();
|
| +
|
| + // If the host is already used by the drag_dest_, there's no point in deleting
|
| + // the old one to create an identical copy.
|
| + if (drag_dest_.get() && drag_dest_->widget() == content_view)
|
| + return;
|
| +
|
| + // Clear the currently connected drag drop signals by deleting the old
|
| + // drag_dest_ before creating the new one.
|
| + drag_dest_.reset();
|
| + // Create the new drag_dest_.
|
| + drag_dest_.reset(new WebDragDestGtk(web_contents_, content_view));
|
| +
|
| + if (delegate_.get())
|
| + drag_dest_->set_delegate(delegate_->GetDragDestDelegate());
|
| +}
|
| +
|
| // Called when the content view gtk widget is tabbed to, or after the call to
|
| // gtk_widget_child_focus() in TakeFocus(). We return true
|
| // and grab focus if we don't have it. The call to
|
|
|