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..fd5e2943c988362aa5a7ab034468eb91ace6323f 100644 |
| --- a/ui/app_list/app_list_model.cc |
| +++ b/ui/app_list/app_list_model.cc |
| @@ -280,6 +280,26 @@ void AppListModel::DeleteItem(const std::string& id) { |
| FOR_EACH_OBSERVER(AppListModelObserver, observers_, OnAppListItemDeleted()); |
| } |
| +void AppListModel::DeleteUninstalledItem(const std::string& id) { |
| + AppListItem* item = FindItem(id); |
| + if (!item) |
| + return; |
| + const std::string folder_id = item->folder_id(); |
| + DeleteItem(id); |
| + |
| + // Issue 368111: Upon uninstall of 2nd-to-last folder item, reparent last item |
|
stevenjb
2015/03/30 17:23:59
nit: crbug.com/368111:
Greg Levin
2015/03/30 23:08:52
Done.
|
| + // to top and remove folder. |
| + AppListFolderItem* folder = FindFolderItem(folder_id); |
| + if (folder && folder->ChildItemCount() == 1u) { |
| + FOR_EACH_OBSERVER(AppListModelObserver, observers_, |
| + OnSingleItemFolderWillBeDeleted(folder_id)); |
|
stevenjb
2015/03/30 17:23:59
In DeleteItem() we call OnAppListItemWillBeDeleted
Greg Levin
2015/03/30 23:08:52
Done. Thanks for pointing this out. It turns out
|
| + |
| + // 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::NotifyExtensionPreferenceChanged() { |
| for (size_t i = 0; i < top_level_item_list_->item_count(); ++i) |
| top_level_item_list_->item_at(i)->OnExtensionPreferenceChanged(); |