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 53e78b4301c955701ee2323282382206eb33c2e3..fe745e65426b42eff7496dff650644f57216f02c 100644 |
| --- a/chrome/browser/ui/views/tabs/tab_drag_controller.cc |
| +++ b/chrome/browser/ui/views/tabs/tab_drag_controller.cc |
| @@ -77,6 +77,12 @@ const int kHorizontalMoveThreshold = 16; // Pixels. |
| // close enough to trigger moving. |
| const int kStackedDistance = 36; |
| +// Dragged window is forced to be a bit smaller than maximized bounds during a |
|
msw
2015/06/05 17:20:51
nit: "Dragged windows are" or "A dragged window"
varkha
2015/06/05 17:55:28
Done.
|
| +// drag. This prevents the dragged browser widget from getting maximized at |
| +// creation and makes it easier to drag tabs out of a restored window that had |
| +// maximized size. |
| +const int kMaximizedWindowInset = 10; // Pixels. |
| + |
| #if defined(USE_ASH) |
| void SetWindowPositionManaged(gfx::NativeWindow window, bool value) { |
| ash::wm::GetWindowState(window)->set_window_position_managed(value); |
| @@ -1640,6 +1646,19 @@ gfx::Rect TabDragController::CalculateDraggedBrowserBounds( |
| gfx::Point center(0, source->height() / 2); |
| views::View::ConvertPointToWidget(source, ¢er); |
| gfx::Rect new_bounds(source->GetWidget()->GetRestoredBounds()); |
| + |
| + // If the restore bounds is larger than work area make dragging window |
|
msw
2015/06/05 17:20:51
nit: comma here "area," and "make the dragging"
msw
2015/06/05 17:20:51
ditto nit: comment redundancy
varkha
2015/06/05 17:55:28
Done (removed the original comment here in favour
|
| + // slightly smaller and behave as if it was maximized at the start of a drag. |
| + gfx::Rect work_area = |
| + screen_->GetDisplayNearestPoint(last_point_in_screen_).work_area(); |
| + if (new_bounds.size().width() >= work_area.size().width() && |
| + new_bounds.size().height() >= work_area.size().height()) { |
| + new_bounds = work_area; |
| + new_bounds.Inset(kMaximizedWindowInset, kMaximizedWindowInset, |
| + kMaximizedWindowInset, kMaximizedWindowInset); |
| + was_source_maximized_ = true; |
| + } |
| + |
| if (source->GetWidget()->IsMaximized()) { |
| // If the restore bounds is really small, we don't want to honor it |
| // (dragging a really small window looks wrong), instead make sure the new |