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

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: More revisions, remove unneeded function 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
« no previous file with comments | « ui/app_list/app_list_model.h ('k') | ui/app_list/app_list_model_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..48394478d48db0605cafddc3bcadcc3e82c3acdf 100644
--- a/ui/app_list/app_list_model.cc
+++ b/ui/app_list/app_list_model.cc
@@ -280,6 +280,22 @@ 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);
+
+ // crbug.com/368111: Upon uninstall of 2nd-to-last folder item, reparent last
+ // item to top; this will remove the folder.
+ AppListFolderItem* folder = FindFolderItem(folder_id);
+ if (folder && folder->ChildItemCount() == 1u) {
+ 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();
« no previous file with comments | « ui/app_list/app_list_model.h ('k') | ui/app_list/app_list_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698