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

Unified Diff: ui/app_list/views/app_list_main_view.cc

Issue 1003393002: After uninstall, remove last item in Launcher folder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/views/app_list_main_view.cc
diff --git a/ui/app_list/views/app_list_main_view.cc b/ui/app_list/views/app_list_main_view.cc
index dceae0faa72d4f49bddc4e827b990d5bc0c64783..ddc0b183ee4a8a36e80f0175abd6a6c926676b99 100644
--- a/ui/app_list/views/app_list_main_view.cc
+++ b/ui/app_list/views/app_list_main_view.cc
@@ -266,6 +266,26 @@ void AppListMainView::UpdateCustomLauncherPageVisibility() {
}
}
+// Issue 368111: Upon uninstall of 2nd-to-last folder item, reparent last child
+// to top and remove folder.
+void AppListMainView::OnAppListChildItemUninstalled(AppListFolderItem* parent) {
+ if (!parent || parent->ChildItemCount() != 1u)
+ return;
+
+ AppsGridView* top_grid_view =
+ contents_view_->apps_container_view()->apps_grid_view();
+ AppsGridView* folder_grid_view = contents_view_->apps_container_view()
+ ->app_list_folder_view()
+ ->items_grid_view();
+
+ model_->top_level_item_list()->RemoveObserver(top_grid_view);
+ folder_grid_view->SetItemList(nullptr); // removes observer
+
+ top_grid_view->RemoveLastItemFromReparentItemFolderIfNecessary(parent->id());
+
+ model_->top_level_item_list()->AddObserver(top_grid_view);
+}
+
Greg Levin 2015/03/14 03:51:45 When "drag app out of folder" uses RemoveLastItemF
jennyz 2015/03/17 21:16:48 Yes, the views are the observers of its associated
Greg Levin 2015/03/23 22:04:50 Ok, that makes sense. Thanks!
void AppListMainView::OnCustomLauncherPageEnabledStateChanged(bool enabled) {
views::View* custom_page = contents_view_->custom_page_view();
if (!custom_page)

Powered by Google App Engine
This is Rietveld 408576698