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 "ui/app_list/views/apps_grid_view.h" | 5 #include "ui/app_list/views/apps_grid_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 } else if (IsValidIndex(reorder_drop_target_)) { | 701 } else if (IsValidIndex(reorder_drop_target_)) { |
702 MoveItemInModel(drag_view_, reorder_drop_target_); | 702 MoveItemInModel(drag_view_, reorder_drop_target_); |
703 } | 703 } |
704 } | 704 } |
705 } | 705 } |
706 | 706 |
707 if (drag_and_drop_host_) { | 707 if (drag_and_drop_host_) { |
708 // If we had a drag and drop proxy icon, we delete it and make the real | 708 // If we had a drag and drop proxy icon, we delete it and make the real |
709 // item visible again. | 709 // item visible again. |
710 drag_and_drop_host_->DestroyDragIconProxy(); | 710 drag_and_drop_host_->DestroyDragIconProxy(); |
711 if (landed_in_drag_and_drop_host) { | 711 // Issue 439055: MoveItemToFolder() can sometimes delete drag_view_ |
712 // Move the item directly to the target location, avoiding the "zip back" | 712 if (drag_view_) { |
713 // animation if the user was pinning it to the shelf. | 713 if (landed_in_drag_and_drop_host) { |
714 int i = reorder_drop_target_.slot; | 714 // Move the item directly to the target location, avoiding the |
715 gfx::Rect bounds = view_model_.ideal_bounds(i); | 715 // "zip back" animation if the user was pinning it to the shelf. |
716 drag_view_->SetBoundsRect(bounds); | 716 int i = reorder_drop_target_.slot; |
| 717 gfx::Rect bounds = view_model_.ideal_bounds(i); |
| 718 drag_view_->SetBoundsRect(bounds); |
| 719 } |
| 720 // Fade in slowly if it landed in the shelf. |
| 721 SetViewHidden(drag_view_, false /* show */, |
| 722 !landed_in_drag_and_drop_host /* animate */); |
717 } | 723 } |
718 // Fade in slowly if it landed in the shelf. | |
719 SetViewHidden(drag_view_, | |
720 false /* show */, | |
721 !landed_in_drag_and_drop_host /* animate */); | |
722 } | 724 } |
723 | 725 |
724 // The drag can be ended after the synchronous drag is created but before it | 726 // The drag can be ended after the synchronous drag is created but before it |
725 // is Run(). | 727 // is Run(). |
726 CleanUpSynchronousDrag(); | 728 CleanUpSynchronousDrag(); |
727 | 729 |
728 SetAsFolderDroppingTarget(folder_drop_target_, false); | 730 SetAsFolderDroppingTarget(folder_drop_target_, false); |
729 ClearDragState(); | 731 ClearDragState(); |
730 AnimateToIdealBounds(); | 732 AnimateToIdealBounds(); |
731 | 733 |
(...skipping 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2168 | 2170 |
2169 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, | 2171 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, |
2170 bool is_target_folder) { | 2172 bool is_target_folder) { |
2171 AppListItemView* target_view = | 2173 AppListItemView* target_view = |
2172 GetViewDisplayedAtSlotOnCurrentPage(target_index.slot); | 2174 GetViewDisplayedAtSlotOnCurrentPage(target_index.slot); |
2173 if (target_view) | 2175 if (target_view) |
2174 target_view->SetAsAttemptedFolderTarget(is_target_folder); | 2176 target_view->SetAsAttemptedFolderTarget(is_target_folder); |
2175 } | 2177 } |
2176 | 2178 |
2177 } // namespace app_list | 2179 } // namespace app_list |
OLD | NEW |