Chromium Code Reviews| Index: ash/shelf/shelf_view.cc |
| diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc |
| index 7304bd833f8478e2823df4c978aca5b965e8ca8a..dae918888a9b1c9f8f1a28f0c947e3868523e116 100644 |
| --- a/ash/shelf/shelf_view.cc |
| +++ b/ash/shelf/shelf_view.cc |
| @@ -1133,10 +1133,26 @@ bool ShelfView::HandleRipOffDrag(const ui::LocatedEvent& event) { |
| UpdateDragIconProxy(screen_location); |
| return true; |
| } |
| - // Check if we are too far away from the shelf to enter the ripped off state. |
| - // Determine the distance to the shelf. |
| + |
| + // Determine if we should enter the ripped off state. We should enter if: |
|
msw
2017/06/06 00:27:23
nit: "Mark the item as dragged off the shelf if th
sammiequon
2017/06/06 16:21:26
Done.
|
| + // 1) The item is dragged more than |kRipOffDistance| from the shelf. |
| + // 2) We are on the overflow shelf and the item is dragged onto the main |
| + // shelf. |
| + // 3) We are on the main shelf and the item is dragged onto the overflow |
| + // shelf. |
| int delta = CalculateShelfDistance(screen_location); |
| - if (delta > kRipOffDistance) { |
| + bool enableRipOff = delta > kRipOffDistance; |
|
msw
2017/06/06 00:27:23
Use the unix_hacker naming convention in Chrome's
sammiequon
2017/06/06 16:21:26
Done.
|
| + enableRipOff = |
| + enableRipOff || |
|
msw
2017/06/06 00:27:23
nit: if you keep separate statements like this, th
sammiequon
2017/06/06 16:21:26
Done.
|
| + (is_overflow_mode() && |
| + main_shelf_->GetBoundsForDragInsertInScreen().Contains(screen_location)); |
| + enableRipOff = enableRipOff || (!is_overflow_mode() && overflow_bubble_ && |
| + overflow_bubble_->IsShowing() && |
| + overflow_bubble_->shelf_view() |
| + ->GetBoundsForDragInsertInScreen() |
| + .Contains(screen_location)); |
| + |
| + if (enableRipOff) { |
| // Create a proxy view item which can be moved anywhere. |
| CreateDragIconProxy(event.root_location(), drag_view_->GetImage(), |
| drag_view_, gfx::Vector2d(0, 0), |