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

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: Another round of revisions 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_observer.h » ('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..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();
« no previous file with comments | « ui/app_list/app_list_model.h ('k') | ui/app_list/app_list_model_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698