Chromium Code Reviews| 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 fd690c3339091c63309980637be68a86bfd3c5d6..5cd5657859bc9d0e4e1a11fffc45720d3f388fef 100644 |
| --- a/chrome/browser/ui/views/tabs/tab_drag_controller.cc |
| +++ b/chrome/browser/ui/views/tabs/tab_drag_controller.cc |
| @@ -484,7 +484,9 @@ void TabDragController::Drag(const gfx::Point& point_in_screen) { |
| Attach(source_tabstrip_, gfx::Point()); |
| if (detach_into_browser_ && static_cast<int>(drag_data_.size()) == |
| GetModel(source_tabstrip_)->count()) { |
| - RunMoveLoop(); // Runs a nested loop, returning when done. |
| + // TODO(erg): The following calculation is off; it only affects the |
| + // linux_aura port though. |
| + RunMoveLoop(mouse_offset_); // Runs a nested loop, returning when done. |
|
sky
2012/08/14 22:49:23
I'm a bit confused. What location are you trying t
Elliot Glaysher
2012/08/14 22:55:00
The offset from the top left corner of the window
|
| return; |
| } |
| } |
| @@ -1266,7 +1268,9 @@ void TabDragController::DetachIntoNewBrowserAndRunMoveLoop( |
| // All the tabs in a browser are being dragged but all the tabs weren't |
| // initially being dragged. For this to happen the user would have to |
| // start dragging a set of tabs, the other tabs close, then detach. |
| - RunMoveLoop(); |
| + |
| + // TODO(erg): This offset isn't perfect on linux_aura. |
| + RunMoveLoop(mouse_offset_); |
| return; |
| } |
| @@ -1280,8 +1284,9 @@ void TabDragController::DetachIntoNewBrowserAndRunMoveLoop( |
| std::vector<gfx::Rect> drag_bounds = |
| CalculateBoundsForDraggedTabs(attached_point.x()); |
| + gfx::Point drag_offset; |
| Browser* browser = CreateBrowserForDrag( |
| - attached_tabstrip_, point_in_screen, &drag_bounds); |
| + attached_tabstrip_, point_in_screen, &drag_offset, &drag_bounds); |
| Detach(DONT_RELEASE_CAPTURE); |
| BrowserView* dragged_browser_view = |
| BrowserView::GetBrowserViewForBrowser(browser); |
| @@ -1295,10 +1300,10 @@ void TabDragController::DetachIntoNewBrowserAndRunMoveLoop( |
| browser->window()->Activate(); |
| dragged_browser_view->GetWidget()->SetVisibilityChangedAnimationsEnabled( |
| true); |
| - RunMoveLoop(); |
| + RunMoveLoop(drag_offset); |
| } |
| -void TabDragController::RunMoveLoop() { |
| +void TabDragController::RunMoveLoop(const gfx::Point& drag_offset) { |
| // If the user drags the whole window we'll assume they are going to attach to |
| // another window and therefor want to reorder. |
| move_behavior_ = REORDER; |
| @@ -1317,7 +1322,8 @@ void TabDragController::RunMoveLoop() { |
| attached_tabstrip_->GetWidget()->ReleaseCapture(); |
| attached_tabstrip_->OwnDragController(this); |
| #endif |
| - views::Widget::MoveLoopResult result = move_loop_widget_->RunMoveLoop(); |
| + views::Widget::MoveLoopResult result = |
| + move_loop_widget_->RunMoveLoop(drag_offset); |
| content::NotificationService::current()->Notify( |
| chrome::NOTIFICATION_TAB_DRAG_LOOP_DONE, |
| content::NotificationService::AllBrowserContextsAndSources(), |
| @@ -1915,6 +1921,7 @@ bool TabDragController::AreTabsConsecutive() { |
| Browser* TabDragController::CreateBrowserForDrag( |
| TabStrip* source, |
| const gfx::Point& point_in_screen, |
| + gfx::Point* drag_offset, |
| std::vector<gfx::Rect>* drag_bounds) { |
| Browser* browser = new Browser( |
| Browser::CreateParams(drag_data_[0].contents->profile())); |
| @@ -1943,6 +1950,8 @@ Browser* TabDragController::CreateBrowserForDrag( |
| break; // Nothing to do for DETACH_ABOVE_OR_BELOW. |
| } |
| + *drag_offset = point_in_screen.Subtract(new_bounds.origin()); |
| + |
| SetTrackedByWorkspace(browser->window()->GetNativeWindow(), false); |
| browser->window()->SetBounds(new_bounds); |
| return browser; |