| 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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 point_in_screen.x() - | 381 point_in_screen.x() - |
| 382 mouse_offset_.x(), 0); | 382 mouse_offset_.x(), 0); |
| 383 widget->SetVisibilityChangedAnimationsEnabled(false); | 383 widget->SetVisibilityChangedAnimationsEnabled(false); |
| 384 widget->Restore(); | 384 widget->Restore(); |
| 385 widget->SetBounds(new_bounds); | 385 widget->SetBounds(new_bounds); |
| 386 AdjustBrowserAndTabBoundsForDrag(last_tabstrip_width, | 386 AdjustBrowserAndTabBoundsForDrag(last_tabstrip_width, |
| 387 point_in_screen, | 387 point_in_screen, |
| 388 &drag_bounds); | 388 &drag_bounds); |
| 389 widget->SetVisibilityChangedAnimationsEnabled(true); | 389 widget->SetVisibilityChangedAnimationsEnabled(true); |
| 390 } | 390 } |
| 391 RunMoveLoop(GetWindowOffset(point_in_screen)); | 391 RunMoveLoop(GetWindowOffset(start_point_in_screen_)); |
| 392 return; | 392 return; |
| 393 } | 393 } |
| 394 } | 394 } |
| 395 | 395 |
| 396 ContinueDragging(point_in_screen); | 396 ContinueDragging(point_in_screen); |
| 397 } | 397 } |
| 398 | 398 |
| 399 void TabDragController::EndDrag(EndDragReason reason) { | 399 void TabDragController::EndDrag(EndDragReason reason) { |
| 400 TRACE_EVENT0("views", "TabDragController::EndDrag"); | 400 TRACE_EVENT0("views", "TabDragController::EndDrag"); |
| 401 | 401 |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 attached_tabstrip_ = NULL; | 1013 attached_tabstrip_ = NULL; |
| 1014 } | 1014 } |
| 1015 | 1015 |
| 1016 void TabDragController::DetachIntoNewBrowserAndRunMoveLoop( | 1016 void TabDragController::DetachIntoNewBrowserAndRunMoveLoop( |
| 1017 const gfx::Point& point_in_screen) { | 1017 const gfx::Point& point_in_screen) { |
| 1018 if (GetModel(attached_tabstrip_)->count() == | 1018 if (GetModel(attached_tabstrip_)->count() == |
| 1019 static_cast<int>(drag_data_.size())) { | 1019 static_cast<int>(drag_data_.size())) { |
| 1020 // All the tabs in a browser are being dragged but all the tabs weren't | 1020 // All the tabs in a browser are being dragged but all the tabs weren't |
| 1021 // initially being dragged. For this to happen the user would have to | 1021 // initially being dragged. For this to happen the user would have to |
| 1022 // start dragging a set of tabs, the other tabs close, then detach. | 1022 // start dragging a set of tabs, the other tabs close, then detach. |
| 1023 RunMoveLoop(GetWindowOffset(point_in_screen)); | 1023 RunMoveLoop(GetWindowOffset(start_point_in_screen_)); |
| 1024 return; | 1024 return; |
| 1025 } | 1025 } |
| 1026 | 1026 |
| 1027 const int last_tabstrip_width = attached_tabstrip_->tab_area_width(); | 1027 const int last_tabstrip_width = attached_tabstrip_->tab_area_width(); |
| 1028 std::vector<gfx::Rect> drag_bounds = CalculateBoundsForDraggedTabs(); | 1028 std::vector<gfx::Rect> drag_bounds = CalculateBoundsForDraggedTabs(); |
| 1029 OffsetX(GetAttachedDragPoint(point_in_screen).x(), &drag_bounds); | 1029 OffsetX(GetAttachedDragPoint(point_in_screen).x(), &drag_bounds); |
| 1030 | 1030 |
| 1031 gfx::Vector2d drag_offset; | 1031 gfx::Vector2d drag_offset; |
| 1032 Browser* browser = CreateBrowserForDrag( | 1032 Browser* browser = CreateBrowserForDrag( |
| 1033 attached_tabstrip_, point_in_screen, &drag_offset, &drag_bounds); | 1033 attached_tabstrip_, point_in_screen, &drag_offset, &drag_bounds); |
| (...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1816 it != browser_list->end(); ++it) { | 1816 it != browser_list->end(); ++it) { |
| 1817 if ((*it)->tab_strip_model()->empty()) | 1817 if ((*it)->tab_strip_model()->empty()) |
| 1818 exclude.insert((*it)->window()->GetNativeWindow()); | 1818 exclude.insert((*it)->window()->GetNativeWindow()); |
| 1819 } | 1819 } |
| 1820 #endif | 1820 #endif |
| 1821 return GetLocalProcessWindowAtPoint(host_desktop_type_, | 1821 return GetLocalProcessWindowAtPoint(host_desktop_type_, |
| 1822 screen_point, | 1822 screen_point, |
| 1823 exclude); | 1823 exclude); |
| 1824 | 1824 |
| 1825 } | 1825 } |
| OLD | NEW |