Chromium Code Reviews| Index: ash/common/shelf/shelf_view.cc |
| diff --git a/ash/common/shelf/shelf_view.cc b/ash/common/shelf/shelf_view.cc |
| index 311b498fdf2822f4be81f5ed416f84610fca0145..686b841dadb9cb09d94d158f58b6d47c6817c13c 100644 |
| --- a/ash/common/shelf/shelf_view.cc |
| +++ b/ash/common/shelf/shelf_view.cc |
| @@ -798,9 +798,7 @@ void ShelfView::PointerPressedOnButton(views::View* view, |
| if (index == -1 || view_model_->view_size() <= 1) |
| return; // View is being deleted, ignore request. |
| - ShelfItemDelegate* item_delegate = |
| - model_->GetShelfItemDelegate(model_->items()[index].id); |
| - if (!item_delegate->IsDraggable()) |
| + if (view == GetAppListButton()) |
| return; // View is not draggable, ignore request. |
| // Only when the repost event occurs on the same shelf item, we should ignore |
| @@ -1104,14 +1102,6 @@ void ShelfView::PrepareForDrag(Pointer pointer, const ui::LocatedEvent& event) { |
| return; |
| } |
| - // If the item is no longer draggable, bail out. |
| - ShelfItemDelegate* item_delegate = |
| - model_->GetShelfItemDelegate(model_->items()[start_drag_index_].id); |
| - if (!item_delegate->IsDraggable()) { |
| - CancelDrag(-1); |
| - return; |
| - } |
| - |
| // Move the view to the front so that it appears on top of other views. |
| ReorderChildView(drag_view_, -1); |
| bounds_animator_->StopAnimatingView(drag_view_); |
| @@ -1120,18 +1110,13 @@ void ShelfView::PrepareForDrag(Pointer pointer, const ui::LocatedEvent& event) { |
| } |
| void ShelfView::ContinueDrag(const ui::LocatedEvent& event) { |
| + DCHECK(dragging()); |
| + DCHECK(drag_view_); |
| // Due to a syncing operation the application might have been removed. |
| // Bail if it is gone. |
| int current_index = view_model_->GetIndexOfView(drag_view_); |
| DCHECK_NE(-1, current_index); |
| - ShelfItemDelegate* item_delegate = |
| - model_->GetShelfItemDelegate(model_->items()[current_index].id); |
| - if (!item_delegate->IsDraggable()) { |
| - CancelDrag(-1); |
| - return; |
| - } |
| - |
| // If this is not a drag and drop host operation and not the app list item, |
| // check if the item got ripped off the shelf - if it did we are done. |
| if (!drag_and_drop_shelf_id_ && |
| @@ -1184,13 +1169,7 @@ void ShelfView::ContinueDrag(const ui::LocatedEvent& event) { |
| target_index = |
| std::min(indices.second, std::max(target_index, indices.first)); |
| - int first_draggable_item = 0; |
| - while (first_draggable_item < static_cast<int>(model_->items().size()) && |
| - !model_->GetShelfItemDelegate(model_->items()[first_draggable_item].id) |
| - ->IsDraggable()) { |
| - first_draggable_item++; |
| - } |
| - |
| + int first_draggable_item = model_->GetItemIndexForType(TYPE_APP_LIST) + 1; |
|
James Cook
2016/12/14 17:41:54
Maybe comment or DCHECK that if the shelf only has
msw
2016/12/14 19:46:50
Added a comment and a couple DCHECKs. The top of t
|
| target_index = std::max(target_index, first_draggable_item); |
| if (target_index == current_index) |