| 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 #ifndef UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ | 5 #ifndef UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ |
| 6 #define UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ | 6 #define UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 bool cancel_drag); | 190 bool cancel_drag); |
| 191 | 191 |
| 192 // Handles EndDrag event in the hidden folder grid view to end reparenting | 192 // Handles EndDrag event in the hidden folder grid view to end reparenting |
| 193 // a folder item. | 193 // a folder item. |
| 194 void EndDragForReparentInHiddenFolderGridView(); | 194 void EndDragForReparentInHiddenFolderGridView(); |
| 195 | 195 |
| 196 // Called when the folder item associated with the grid view is removed. | 196 // Called when the folder item associated with the grid view is removed. |
| 197 // The grid view must be inside a folder view. | 197 // The grid view must be inside a folder view. |
| 198 void OnFolderItemRemoved(); | 198 void OnFolderItemRemoved(); |
| 199 | 199 |
| 200 // If there is only 1 item left in the source folder after reparenting an item |
| 201 // from it, updates both data model and view_model_ for removing last item |
| 202 // from the source folder and removes the source folder. |
| 203 void RemoveLastItemFromReparentItemFolderIfNecessary( |
| 204 const std::string& source_folder_id); |
| 205 |
| 200 // Return the view model for test purposes. | 206 // Return the view model for test purposes. |
| 201 const views::ViewModelT<AppListItemView>* view_model_for_test() const { | 207 const views::ViewModelT<AppListItemView>* view_model_for_test() const { |
| 202 return &view_model_; | 208 return &view_model_; |
| 203 } | 209 } |
| 204 | 210 |
| 205 // For test: Return if the drag and drop handler was set. | 211 // For test: Return if the drag and drop handler was set. |
| 206 bool has_drag_and_drop_host_for_test() { | 212 bool has_drag_and_drop_host_for_test() { |
| 207 return nullptr != drag_and_drop_host_; | 213 return nullptr != drag_and_drop_host_; |
| 208 } | 214 } |
| 209 | 215 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 | 353 |
| 348 // Updates both data model and view_model_ for re-parenting a folder item to a | 354 // Updates both data model and view_model_ for re-parenting a folder item to a |
| 349 // new position in top level item list. | 355 // new position in top level item list. |
| 350 void ReparentItemForReorder(AppListItemView* item_view, const Index& target); | 356 void ReparentItemForReorder(AppListItemView* item_view, const Index& target); |
| 351 | 357 |
| 352 // Updates both data model and view_model_ for re-parenting a folder item | 358 // Updates both data model and view_model_ for re-parenting a folder item |
| 353 // to anther folder target. Returns whether the reparent succeeded. | 359 // to anther folder target. Returns whether the reparent succeeded. |
| 354 bool ReparentItemToAnotherFolder(AppListItemView* item_view, | 360 bool ReparentItemToAnotherFolder(AppListItemView* item_view, |
| 355 const Index& target); | 361 const Index& target); |
| 356 | 362 |
| 357 // If there is only 1 item left in the source folder after reparenting an item | |
| 358 // from it, updates both data model and view_model_ for removing last item | |
| 359 // from the source folder and removes the source folder. | |
| 360 void RemoveLastItemFromReparentItemFolderIfNecessary( | |
| 361 const std::string& source_folder_id); | |
| 362 | |
| 363 // If user does not drop the re-parenting folder item to any valid target, | 363 // If user does not drop the re-parenting folder item to any valid target, |
| 364 // cancel the re-parenting action, let the item go back to its original | 364 // cancel the re-parenting action, let the item go back to its original |
| 365 // parent folder with UI animation. | 365 // parent folder with UI animation. |
| 366 void CancelFolderItemReparent(AppListItemView* drag_item_view); | 366 void CancelFolderItemReparent(AppListItemView* drag_item_view); |
| 367 | 367 |
| 368 // Cancels any context menus showing for app items on the current page. | 368 // Cancels any context menus showing for app items on the current page. |
| 369 void CancelContextMenusOnCurrentPage(); | 369 void CancelContextMenusOnCurrentPage(); |
| 370 | 370 |
| 371 // Removes the AppListItemView at |index| in |view_model_| and deletes it. | 371 // Removes the AppListItemView at |index| in |view_model_| and deletes it. |
| 372 void DeleteItemViewAtIndex(int index); | 372 void DeleteItemViewAtIndex(int index); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 | 574 |
| 575 // True if the drag_view_ item is a folder item being dragged for reparenting. | 575 // True if the drag_view_ item is a folder item being dragged for reparenting. |
| 576 bool dragging_for_reparent_item_; | 576 bool dragging_for_reparent_item_; |
| 577 | 577 |
| 578 DISALLOW_COPY_AND_ASSIGN(AppsGridView); | 578 DISALLOW_COPY_AND_ASSIGN(AppsGridView); |
| 579 }; | 579 }; |
| 580 | 580 |
| 581 } // namespace app_list | 581 } // namespace app_list |
| 582 | 582 |
| 583 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ | 583 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ |
| OLD | NEW |