Chromium Code Reviews| Index: ui/app_list/app_list_model.cc |
| diff --git a/ui/app_list/app_list_model.cc b/ui/app_list/app_list_model.cc |
| index 0a8e0cd33bfc5b8b006eb65fd62d4dbaf375cb41..468f32414bbae6e21e306da84ae9c633b98a2a55 100644 |
| --- a/ui/app_list/app_list_model.cc |
| +++ b/ui/app_list/app_list_model.cc |
| @@ -219,6 +219,25 @@ bool AppListModel::MoveItemToFolderAt(AppListItem* item, |
| return true; |
| } |
| +void AppListModel::DeleteUninstalledItem(const std::string& id) { |
| + AppListItem* item = FindItem(id); |
| + if (!item) |
| + return; |
| + AppListFolderItem* folder = FindFolderItem(item->folder_id()); |
| + DeleteItem(id); |
|
stevenjb
2015/03/25 22:24:00
What happens if this is the last item in a folder?
Greg Levin
2015/03/26 19:45:11
Yes, good call.
|
| + |
| + // Issue 368111: Upon uninstall of 2nd-to-last folder item, reparent last item |
| + // to top and remove folder. |
| + if (folder && folder->ChildItemCount() == 1u) { |
| + FOR_EACH_OBSERVER(AppListModelObserver, observers_, |
| + OnSingleItemFolderWillBeDeleted()); |
| + |
| + // Move last item in model, folder and views will update themselves. |
| + AppListItem* last_item = folder->item_list()->item_at(0); |
| + MoveItemToFolderAt(last_item, "", folder->position()); |
| + } |
| +} |
| + |
| void AppListModel::SetItemPosition(AppListItem* item, |
| const syncer::StringOrdinal& new_position) { |
| if (!item->IsInFolder()) { |