Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(408)

Unified Diff: ui/app_list/app_list_model.cc

Issue 1003393002: After uninstall, remove last item in Launcher folder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move work from views to model, as per reviewer comment Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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()) {

Powered by Google App Engine
This is Rietveld 408576698