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 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1680 views::View::ConvertPointToWidget(source, &right_edge); | 1680 views::View::ConvertPointToWidget(source, &right_edge); |
1681 new_bounds.set_x(point_in_screen.x() - right_edge.x()); | 1681 new_bounds.set_x(point_in_screen.x() - right_edge.x()); |
1682 new_bounds.Offset(drag_bounds->back().right() - mouse_offset_.x(), 0); | 1682 new_bounds.Offset(drag_bounds->back().right() - mouse_offset_.x(), 0); |
1683 OffsetX(-(*drag_bounds)[0].x(), drag_bounds); | 1683 OffsetX(-(*drag_bounds)[0].x(), drag_bounds); |
1684 break; | 1684 break; |
1685 } | 1685 } |
1686 default: | 1686 default: |
1687 break; // Nothing to do for DETACH_ABOVE_OR_BELOW. | 1687 break; // Nothing to do for DETACH_ABOVE_OR_BELOW. |
1688 } | 1688 } |
1689 | 1689 |
1690 // To account for the extra vertical on restored windows that is absent on | 1690 // Account for the extra space above the tabstrip on restored windows versus |
1691 // maximized windows, add an additional vertical offset extracted from the tab | 1691 // maximized windows. |
1692 // strip. | 1692 if (source->GetWidget()->IsMaximized()) { |
1693 if (source->GetWidget()->IsMaximized()) | 1693 const auto* frame_view = static_cast<BrowserNonClientFrameView*>( |
1694 new_bounds.Offset(0, -source->kNewTabButtonVerticalOffset); | 1694 source->GetWidget()->non_client_view()->frame_view()); |
| 1695 new_bounds.Offset( |
| 1696 0, frame_view->GetTopInset(false) - frame_view->GetTopInset(true)); |
| 1697 } |
1695 return new_bounds; | 1698 return new_bounds; |
1696 } | 1699 } |
1697 | 1700 |
1698 void TabDragController::AdjustBrowserAndTabBoundsForDrag( | 1701 void TabDragController::AdjustBrowserAndTabBoundsForDrag( |
1699 int last_tabstrip_width, | 1702 int last_tabstrip_width, |
1700 const gfx::Point& point_in_screen, | 1703 const gfx::Point& point_in_screen, |
1701 std::vector<gfx::Rect>* drag_bounds) { | 1704 std::vector<gfx::Rect>* drag_bounds) { |
1702 attached_tabstrip_->InvalidateLayout(); | 1705 attached_tabstrip_->InvalidateLayout(); |
1703 attached_tabstrip_->DoLayout(); | 1706 attached_tabstrip_->DoLayout(); |
1704 const int dragged_tabstrip_width = attached_tabstrip_->GetTabAreaWidth(); | 1707 const int dragged_tabstrip_width = attached_tabstrip_->GetTabAreaWidth(); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1809 chrome::HOST_DESKTOP_TYPE_NATIVE); | 1812 chrome::HOST_DESKTOP_TYPE_NATIVE); |
1810 for (BrowserList::const_iterator it = browser_list->begin(); | 1813 for (BrowserList::const_iterator it = browser_list->begin(); |
1811 it != browser_list->end(); ++it) { | 1814 it != browser_list->end(); ++it) { |
1812 if ((*it)->tab_strip_model()->empty()) | 1815 if ((*it)->tab_strip_model()->empty()) |
1813 exclude.insert((*it)->window()->GetNativeWindow()); | 1816 exclude.insert((*it)->window()->GetNativeWindow()); |
1814 } | 1817 } |
1815 #endif | 1818 #endif |
1816 return GetLocalProcessWindowAtPoint(host_desktop_type_, screen_point, exclude, | 1819 return GetLocalProcessWindowAtPoint(host_desktop_type_, screen_point, exclude, |
1817 dragged_window); | 1820 dragged_window); |
1818 } | 1821 } |
OLD | NEW |