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()) | |
Matt Giuca
2015/05/11 06:50:41
Shouldn't you still take into account the GetYSize
calamity
2015/05/11 07:15:03
Yeah.. I thought about this too. Ideally we'd clea
| |
168 continue; | |
169 | |
170 view->NotifyFirstResultYIndex(result_y_index); | |
171 result_y_index += view->GetYSize(); | |
163 } | 172 } |
164 } | 173 } |
165 | 174 |
166 Layout(); | 175 Layout(); |
167 SetSelectedIndex(0, false); | 176 SetSelectedIndex(0, false); |
168 } | 177 } |
169 | 178 |
170 gfx::Rect SearchResultPageView::GetPageBoundsForState( | 179 gfx::Rect SearchResultPageView::GetPageBoundsForState( |
171 AppListModel::State state) const { | 180 AppListModel::State state) const { |
172 gfx::Rect onscreen_bounds = GetDefaultContentsBounds(); | 181 gfx::Rect onscreen_bounds = GetDefaultContentsBounds(); |
(...skipping 18 matching lines...) Expand all Loading... | |
191 set_clip_insets(bounds().InsetsFrom(onscreen_bounds)); | 200 set_clip_insets(bounds().InsetsFrom(onscreen_bounds)); |
192 } | 201 } |
193 | 202 |
194 int SearchResultPageView::GetSearchBoxZHeight() const { | 203 int SearchResultPageView::GetSearchBoxZHeight() const { |
195 return switches::IsExperimentalAppListEnabled() | 204 return switches::IsExperimentalAppListEnabled() |
196 ? kSearchResultZHeight | 205 ? kSearchResultZHeight |
197 : AppListPage::GetSearchBoxZHeight(); | 206 : AppListPage::GetSearchBoxZHeight(); |
198 } | 207 } |
199 | 208 |
200 } // namespace app_list | 209 } // namespace app_list |
OLD | NEW |