Index: chrome/browser/ui/views/tabs/tab_drag_controller.cc |
diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller.cc b/chrome/browser/ui/views/tabs/tab_drag_controller.cc |
index c3980924258555be4adeb146fc11318f6f8da8a6..79ce2d21fd85313d683d31ecac637e332c877638 100644 |
--- a/chrome/browser/ui/views/tabs/tab_drag_controller.cc |
+++ b/chrome/browser/ui/views/tabs/tab_drag_controller.cc |
@@ -489,6 +489,9 @@ void TabDragController::Drag(const gfx::Point& point_in_screen) { |
return; // User hasn't dragged far enough yet. |
started_drag_ = true; |
+ // Prevent the WebContents HWND from being hidden by any of the model |
+ // operations performed during the drag. |
+ source_dragged_contents()->SetCapturingContents(true); |
SaveFocus(); |
Attach(source_tabstrip_, gfx::Point()); |
if (detach_into_browser_ && static_cast<int>(drag_data_.size()) == |
@@ -1135,9 +1138,6 @@ void TabDragController::Attach(TabStrip* attached_tabstrip, |
drag_data_[i].contents->SetDelegate(NULL); |
drag_data_[i].original_delegate = NULL; |
} |
- |
- // Return the WebContents to normalcy. |
- source_dragged_contents()->SetCapturingContents(false); |
} |
// Inserting counts as a move. We don't want the tabs to jitter when the |
@@ -1223,11 +1223,6 @@ void TabDragController::Detach(ReleaseCapture release_capture) { |
mouse_move_direction_ = kMovedMouseLeft | kMovedMouseRight; |
- // Prevent the WebContents HWND from being hidden by any of the model |
- // operations performed during the drag. |
- if (!detach_into_browser_) |
- source_dragged_contents()->SetCapturingContents(true); |
- |
std::vector<gfx::Rect> drag_bounds = CalculateBoundsForDraggedTabs(0); |
TabStripModel* attached_model = GetModel(attached_tabstrip_); |
std::vector<TabRendererData> tab_data; |
@@ -1605,6 +1600,7 @@ void TabDragController::EndDragImpl(EndDragType type) { |
// enough to trigger a drag. |
if (started_drag_) { |
RestoreFocus(); |
+ source_dragged_contents()->SetCapturingContents(false); |
if (type == CANCELED) |
RevertDrag(); |
else |