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

Side by Side 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: rebase 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/app_list/views/search_result_page_view.h" 5 #include "ui/app_list/views/search_result_page_view.h"
6 6
7 #include "ui/app_list/app_list_constants.h" 7 #include "ui/app_list/app_list_constants.h"
8 #include "ui/app_list/app_list_switches.h" 8 #include "ui/app_list/app_list_switches.h"
9 #include "ui/app_list/app_list_view_delegate.h" 9 #include "ui/app_list/app_list_view_delegate.h"
10 #include "ui/app_list/views/app_list_main_view.h" 10 #include "ui/app_list/views/app_list_main_view.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // Set the new selected view's selection to its first result. 124 // Set the new selected view's selection to its first result.
125 result_container_views_[selected_index_]->OnContainerSelected(from_bottom); 125 result_container_views_[selected_index_]->OnContainerSelected(from_bottom);
126 } 126 }
127 127
128 bool SearchResultPageView::IsValidSelectionIndex(int index) { 128 bool SearchResultPageView::IsValidSelectionIndex(int index) {
129 return index >= 0 && index < static_cast<int>(result_container_views_.size()); 129 return index >= 0 && index < static_cast<int>(result_container_views_.size());
130 } 130 }
131 131
132 void SearchResultPageView::ChildPreferredSizeChanged(views::View* child) { 132 void SearchResultPageView::ChildPreferredSizeChanged(views::View* child) {
133 DCHECK(!result_container_views_.empty()); 133 DCHECK(!result_container_views_.empty());
134
135 if (switches::IsExperimentalAppListEnabled()) {
136 // Sort the result container views by their score.
137 std::sort(result_container_views_.begin(), result_container_views_.end(),
138 [](const SearchResultContainerView* a,
139 const SearchResultContainerView* b) -> bool {
140 return a->container_score() > b->container_score();
Matt Giuca 2015/02/17 08:24:20 LAMBDA!!!! Half-Life 3 confirmed.
calamity 2015/02/18 01:28:30 Acknowledged.
141 });
142
143 for (size_t i = 0; i < result_container_views_.size(); ++i) {
144 result_container_views_[i]->ClearSelectedIndex();
145 ReorderChildView(result_container_views_[i]->parent(), i);
146 }
147 }
148
134 Layout(); 149 Layout();
135 SetSelectedIndex(0); 150 SetSelectedIndex(0);
136 } 151 }
137 152
138 } // namespace app_list 153 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698