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

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

Issue 922063003: Sort experimental app list search result groups. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_search_results_not_being_there
Patch Set: force test to be experimental app list Created 5 years, 10 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/views/search_result_page_view.h ('k') | ui/app_list/views/search_result_page_view_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/views/search_result_page_view.cc
diff --git a/ui/app_list/views/search_result_page_view.cc b/ui/app_list/views/search_result_page_view.cc
index c575635c9e00eae2632e58020355bddc2d9b8728..9ac549c8394aa2aaeaf169313ee7f3aa7d7247d4 100644
--- a/ui/app_list/views/search_result_page_view.cc
+++ b/ui/app_list/views/search_result_page_view.cc
@@ -131,6 +131,21 @@ bool SearchResultPageView::IsValidSelectionIndex(int index) {
void SearchResultPageView::ChildPreferredSizeChanged(views::View* child) {
DCHECK(!result_container_views_.empty());
+
+ if (switches::IsExperimentalAppListEnabled()) {
+ // Sort the result container views by their score.
+ std::sort(result_container_views_.begin(), result_container_views_.end(),
+ [](const SearchResultContainerView* a,
+ const SearchResultContainerView* b) -> bool {
+ return a->container_score() > b->container_score();
+ });
+
+ for (size_t i = 0; i < result_container_views_.size(); ++i) {
+ result_container_views_[i]->ClearSelectedIndex();
+ ReorderChildView(result_container_views_[i]->parent(), i);
+ }
+ }
+
Layout();
SetSelectedIndex(0);
}
« no previous file with comments | « ui/app_list/views/search_result_page_view.h ('k') | ui/app_list/views/search_result_page_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698