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 9cb9212787816e8c54b169cb2bc5f3a37229a326..f263c5f3f10073b3d3169dd78cfe707d4badd22a 100644 |
--- a/content/browser/web_contents/web_contents_view_gtk.cc |
+++ b/content/browser/web_contents/web_contents_view_gtk.cc |
@@ -223,12 +223,17 @@ RenderWidgetHostView* WebContentsViewGtk::CreateViewForWidget( |
GDK_POINTER_MOTION_MASK); |
InsertIntoContentArea(content_view); |
- // 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()) |
+ // If |rvh| is already the current render view host for the web contents, we |
+ // need to initialize |drag_dest_| for drags to be properly handled. |
+ // Otherwise, |drag_dest_| will be updated in RenderViewSwappedIn. The |
+ // reason we can't simply check that this isn't a swapped-out view is |
+ // because there are navigations that create non-swapped-out views that may |
+ // never be displayed, e.g. a navigation that becomes a download. |
+ if (rvh == web_contents_->GetRenderViewHost()) { |
UpdateDragDest(rvh); |
+ } |
} |
return view; |