OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_list_view.h" | 5 #include "ui/app_list/views/search_result_list_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 } | 137 } |
138 | 138 |
139 void SearchResultListView::OnContainerSelected(bool from_bottom, | 139 void SearchResultListView::OnContainerSelected(bool from_bottom, |
140 bool /*directional_movement*/) { | 140 bool /*directional_movement*/) { |
141 if (num_results() == 0) | 141 if (num_results() == 0) |
142 return; | 142 return; |
143 | 143 |
144 SetSelectedIndex(from_bottom ? num_results() - 1 : 0); | 144 SetSelectedIndex(from_bottom ? num_results() - 1 : 0); |
145 } | 145 } |
146 | 146 |
| 147 void SearchResultListView::NotifyFirstResultYIndex(int y_index) { |
| 148 for (size_t i = 0; i < static_cast<size_t>(num_results()); ++i) |
| 149 GetResultViewAt(i)->result()->set_distance_from_origin(i + y_index); |
| 150 } |
| 151 |
| 152 int SearchResultListView::GetYSize() { |
| 153 return num_results(); |
| 154 } |
| 155 |
147 int SearchResultListView::Update() { | 156 int SearchResultListView::Update() { |
148 std::vector<SearchResult*> display_results = | 157 std::vector<SearchResult*> display_results = |
149 AppListModel::FilterSearchResultsByDisplayType( | 158 AppListModel::FilterSearchResultsByDisplayType( |
150 results(), | 159 results(), |
151 SearchResult::DISPLAY_LIST, | 160 SearchResult::DISPLAY_LIST, |
152 results_container_->child_count()); | 161 results_container_->child_count()); |
153 | 162 |
154 for (size_t i = 0; i < static_cast<size_t>(results_container_->child_count()); | 163 for (size_t i = 0; i < static_cast<size_t>(results_container_->child_count()); |
155 ++i) { | 164 ++i) { |
156 SearchResultView* result_view = GetResultViewAt(i); | 165 SearchResultView* result_view = GetResultViewAt(i); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 view->result(), action_index, event_flags); | 257 view->result(), action_index, event_flags); |
249 } | 258 } |
250 } | 259 } |
251 | 260 |
252 void SearchResultListView::OnSearchResultInstalled(SearchResultView* view) { | 261 void SearchResultListView::OnSearchResultInstalled(SearchResultView* view) { |
253 if (delegate_ && view->result()) | 262 if (delegate_ && view->result()) |
254 delegate_->OnResultInstalled(view->result()); | 263 delegate_->OnResultInstalled(view->result()); |
255 } | 264 } |
256 | 265 |
257 } // namespace app_list | 266 } // namespace app_list |
OLD | NEW |