| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/tabs/tab_drag_controller.h" | 5 #include "chrome/browser/ui/views/tabs/tab_drag_controller.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 point_in_screen.x() - | 383 point_in_screen.x() - |
| 384 mouse_offset_.x(), 0); | 384 mouse_offset_.x(), 0); |
| 385 widget->SetVisibilityChangedAnimationsEnabled(false); | 385 widget->SetVisibilityChangedAnimationsEnabled(false); |
| 386 widget->Restore(); | 386 widget->Restore(); |
| 387 widget->SetBounds(new_bounds); | 387 widget->SetBounds(new_bounds); |
| 388 AdjustBrowserAndTabBoundsForDrag(last_tabstrip_width, | 388 AdjustBrowserAndTabBoundsForDrag(last_tabstrip_width, |
| 389 point_in_screen, | 389 point_in_screen, |
| 390 &drag_bounds); | 390 &drag_bounds); |
| 391 widget->SetVisibilityChangedAnimationsEnabled(true); | 391 widget->SetVisibilityChangedAnimationsEnabled(true); |
| 392 } | 392 } |
| 393 RunMoveLoop(GetWindowOffset(point_in_screen)); | 393 // Use the start point to initialize the move loop, otherwise the point |
| 394 // under the cursor will be offset by the drag threshold from where the |
| 395 // user originally clicked, which could be entirely off the window. |
| 396 RunMoveLoop(GetWindowOffset(start_point_in_screen_)); |
| 394 return; | 397 return; |
| 395 } | 398 } |
| 396 } | 399 } |
| 397 | 400 |
| 398 if (ContinueDragging(point_in_screen) == Liveness::DELETED) | 401 if (ContinueDragging(point_in_screen) == Liveness::DELETED) |
| 399 return; | 402 return; |
| 400 } | 403 } |
| 401 | 404 |
| 402 void TabDragController::EndDrag(EndDragReason reason) { | 405 void TabDragController::EndDrag(EndDragReason reason) { |
| 403 TRACE_EVENT0("views", "TabDragController::EndDrag"); | 406 TRACE_EVENT0("views", "TabDragController::EndDrag"); |
| (...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1807 // TODO(pkotwicz): Fix this properly (crbug.com/358482) | 1810 // TODO(pkotwicz): Fix this properly (crbug.com/358482) |
| 1808 for (auto* browser : *BrowserList::GetInstance()) { | 1811 for (auto* browser : *BrowserList::GetInstance()) { |
| 1809 if (browser->tab_strip_model()->empty()) | 1812 if (browser->tab_strip_model()->empty()) |
| 1810 exclude.insert(browser->window()->GetNativeWindow()); | 1813 exclude.insert(browser->window()->GetNativeWindow()); |
| 1811 } | 1814 } |
| 1812 #endif | 1815 #endif |
| 1813 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr()); | 1816 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr()); |
| 1814 *window = window_finder_->GetLocalProcessWindowAtPoint(screen_point, exclude); | 1817 *window = window_finder_->GetLocalProcessWindowAtPoint(screen_point, exclude); |
| 1815 return ref ? Liveness::ALIVE : Liveness::DELETED; | 1818 return ref ? Liveness::ALIVE : Liveness::DELETED; |
| 1816 } | 1819 } |
| OLD | NEW |