Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(777)

Side by Side Diff: ui/app_list/search/mixer.cc

Issue 1071093002: Implement setSearchResults. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clear results after query is ended. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/search/mixer.h" 5 #include "ui/app_list/search/mixer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 FetchResults(is_voice_query, known_results); 145 FetchResults(is_voice_query, known_results);
146 146
147 SortedResults results; 147 SortedResults results;
148 results.reserve(kMaxResults); 148 results.reserve(kMaxResults);
149 149
150 const Group& main_group = *groups_[MAIN_GROUP]; 150 const Group& main_group = *groups_[MAIN_GROUP];
151 const Group& omnibox_group = *groups_[OMNIBOX_GROUP]; 151 const Group& omnibox_group = *groups_[OMNIBOX_GROUP];
152 const Group& webstore_group = *groups_[WEBSTORE_GROUP]; 152 const Group& webstore_group = *groups_[WEBSTORE_GROUP];
153 const Group& people_group = *groups_[PEOPLE_GROUP]; 153 const Group& people_group = *groups_[PEOPLE_GROUP];
154 const Group& suggestions_group = *groups_[SUGGESTIONS_GROUP]; 154 const Group& suggestions_group = *groups_[SUGGESTIONS_GROUP];
155 const Group& launcher_search_api_group = *groups_[LAUNCHER_SEARCH_API_GROUP];
Matt Giuca 2015/04/10 03:55:17 Heads up: I am going to try and land https://coder
yawano 2015/04/10 04:05:38 Okay, I'll wait until http://crrev.com/882463004 l
155 156
156 // Adds main group and web store results first. 157 // Adds main group and web store results first.
157 results.insert(results.end(), main_group.results().begin(), 158 results.insert(results.end(), main_group.results().begin(),
158 main_group.results().end()); 159 main_group.results().end());
159 results.insert(results.end(), webstore_group.results().begin(), 160 results.insert(results.end(), webstore_group.results().begin(),
160 webstore_group.results().end()); 161 webstore_group.results().end());
161 results.insert(results.end(), people_group.results().begin(), 162 results.insert(results.end(), people_group.results().begin(),
162 people_group.results().end()); 163 people_group.results().end());
163 results.insert(results.end(), suggestions_group.results().begin(), 164 results.insert(results.end(), suggestions_group.results().begin(),
164 suggestions_group.results().end()); 165 suggestions_group.results().end());
166 results.insert(results.end(), launcher_search_api_group.results().begin(),
167 launcher_search_api_group.results().end());
165 168
166 // Collapse duplicate apps from local and web store. 169 // Collapse duplicate apps from local and web store.
167 RemoveDuplicates(&results); 170 RemoveDuplicates(&results);
168 171
169 // Fill the remaining slots with omnibox results. Always add at least one 172 // Fill the remaining slots with omnibox results. Always add at least one
170 // omnibox result (even if there are no more slots; if we over-fill the 173 // omnibox result (even if there are no more slots; if we over-fill the
171 // vector, the web store and people results will be removed in a later step). 174 // vector, the web store and people results will be removed in a later step).
172 const size_t omnibox_results = 175 const size_t omnibox_results =
173 std::min(omnibox_group.results().size(), 176 std::min(omnibox_group.results().size(),
174 results.size() < kMaxResults ? kMaxResults - results.size() : 1); 177 results.size() < kMaxResults ? kMaxResults - results.size() : 1);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 results->swap(final); 254 results->swap(final);
252 } 255 }
253 256
254 void Mixer::FetchResults(bool is_voice_query, 257 void Mixer::FetchResults(bool is_voice_query,
255 const KnownResults& known_results) { 258 const KnownResults& known_results) {
256 for (const auto& item : groups_) 259 for (const auto& item : groups_)
257 item.second->FetchResults(is_voice_query, known_results); 260 item.second->FetchResults(is_voice_query, known_results);
258 } 261 }
259 262
260 } // namespace app_list 263 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698