Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 |
| OLD | NEW |