Chromium Code Reviews| 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 SearchResultView* result_view = GetResultViewAt(i); | |
| 150 result_view->result()->set_distance_from_origin(i + y_index); | |
|
Matt Giuca
2015/05/11 06:50:41
nit: Can you just combine this into one statement
calamity
2015/05/11 07:15:03
Done.
| |
| 151 } | |
| 152 } | |
| 153 | |
| 154 int SearchResultListView::GetYSize() { | |
| 155 return num_results(); | |
| 156 } | |
| 157 | |
| 147 int SearchResultListView::Update() { | 158 int SearchResultListView::Update() { |
| 148 std::vector<SearchResult*> display_results = | 159 std::vector<SearchResult*> display_results = |
| 149 AppListModel::FilterSearchResultsByDisplayType( | 160 AppListModel::FilterSearchResultsByDisplayType( |
| 150 results(), | 161 results(), |
| 151 SearchResult::DISPLAY_LIST, | 162 SearchResult::DISPLAY_LIST, |
| 152 results_container_->child_count()); | 163 results_container_->child_count()); |
| 153 | 164 |
| 154 for (size_t i = 0; i < static_cast<size_t>(results_container_->child_count()); | 165 for (size_t i = 0; i < static_cast<size_t>(results_container_->child_count()); |
| 155 ++i) { | 166 ++i) { |
| 156 SearchResultView* result_view = GetResultViewAt(i); | 167 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); | 259 view->result(), action_index, event_flags); |
| 249 } | 260 } |
| 250 } | 261 } |
| 251 | 262 |
| 252 void SearchResultListView::OnSearchResultInstalled(SearchResultView* view) { | 263 void SearchResultListView::OnSearchResultInstalled(SearchResultView* view) { |
| 253 if (delegate_ && view->result()) | 264 if (delegate_ && view->result()) |
| 254 delegate_->OnResultInstalled(view->result()); | 265 delegate_->OnResultInstalled(view->result()); |
| 255 } | 266 } |
| 256 | 267 |
| 257 } // namespace app_list | 268 } // namespace app_list |
| OLD | NEW |