| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ui/app_list/app_list_constants.h" | 9 #include "ui/app_list/app_list_constants.h" |
| 10 #include "ui/app_list/app_list_switches.h" | 10 #include "ui/app_list/app_list_switches.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 DCHECK(!result_container_views_.empty()); | 150 DCHECK(!result_container_views_.empty()); |
| 151 | 151 |
| 152 if (switches::IsExperimentalAppListEnabled()) { | 152 if (switches::IsExperimentalAppListEnabled()) { |
| 153 // Sort the result container views by their score. | 153 // Sort the result container views by their score. |
| 154 std::sort(result_container_views_.begin(), result_container_views_.end(), | 154 std::sort(result_container_views_.begin(), result_container_views_.end(), |
| 155 [](const SearchResultContainerView* a, | 155 [](const SearchResultContainerView* a, |
| 156 const SearchResultContainerView* b) -> bool { | 156 const SearchResultContainerView* b) -> bool { |
| 157 return a->container_score() > b->container_score(); | 157 return a->container_score() > b->container_score(); |
| 158 }); | 158 }); |
| 159 | 159 |
| 160 int result_y_index = 0; |
| 160 for (size_t i = 0; i < result_container_views_.size(); ++i) { | 161 for (size_t i = 0; i < result_container_views_.size(); ++i) { |
| 161 result_container_views_[i]->ClearSelectedIndex(); | 162 SearchResultContainerView* view = result_container_views_[i]; |
| 162 ReorderChildView(result_container_views_[i]->parent(), i); | 163 view->ClearSelectedIndex(); |
| 164 ReorderChildView(view->parent(), i); |
| 165 |
| 166 // Only notify containers that have finished updating. |
| 167 if (!view->UpdateScheduled()) |
| 168 view->NotifyFirstResultYIndex(result_y_index); |
| 169 |
| 170 result_y_index += view->GetYSize(); |
| 163 } | 171 } |
| 164 } | 172 } |
| 165 | 173 |
| 166 Layout(); | 174 Layout(); |
| 167 SetSelectedIndex(0, false); | 175 SetSelectedIndex(0, false); |
| 168 } | 176 } |
| 169 | 177 |
| 170 gfx::Rect SearchResultPageView::GetPageBoundsForState( | 178 gfx::Rect SearchResultPageView::GetPageBoundsForState( |
| 171 AppListModel::State state) const { | 179 AppListModel::State state) const { |
| 172 gfx::Rect onscreen_bounds = GetDefaultContentsBounds(); | 180 gfx::Rect onscreen_bounds = GetDefaultContentsBounds(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 191 set_clip_insets(bounds().InsetsFrom(onscreen_bounds)); | 199 set_clip_insets(bounds().InsetsFrom(onscreen_bounds)); |
| 192 } | 200 } |
| 193 | 201 |
| 194 int SearchResultPageView::GetSearchBoxZHeight() const { | 202 int SearchResultPageView::GetSearchBoxZHeight() const { |
| 195 return switches::IsExperimentalAppListEnabled() | 203 return switches::IsExperimentalAppListEnabled() |
| 196 ? kSearchResultZHeight | 204 ? kSearchResultZHeight |
| 197 : AppListPage::GetSearchBoxZHeight(); | 205 : AppListPage::GetSearchBoxZHeight(); |
| 198 } | 206 } |
| 199 | 207 |
| 200 } // namespace app_list | 208 } // namespace app_list |
| OLD | NEW |