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

Unified Diff: ui/app_list/search/mixer.cc

Issue 2225073002: [Chrome OS] Change layout of the launcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address xiyuan@'s comments. Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: ui/app_list/search/mixer.cc
diff --git a/ui/app_list/search/mixer.cc b/ui/app_list/search/mixer.cc
index f5b7e998d1a5d4adee4245ced1101207a3db8df6..e1927c80cb5e48f6bfcee4cc96d3e2d027eba133 100644
--- a/ui/app_list/search/mixer.cc
+++ b/ui/app_list/search/mixer.cc
@@ -11,6 +11,7 @@
#include <vector>
#include "base/macros.h"
+#include "ui/app_list/app_list_constants.h"
#include "ui/app_list/search_provider.h"
#include "ui/app_list/search_result.h"
@@ -19,7 +20,7 @@ namespace app_list {
namespace {
// Maximum number of results to show.
-const size_t kMinResults = 6;
+const size_t kMinResults = 9;
void UpdateResult(const SearchResult& source, SearchResult* target) {
target->set_display_type(source.display_type());
@@ -137,12 +138,15 @@ void Mixer::AddProviderToGroup(size_t group_id, SearchProvider* provider) {
groups_[group_id]->AddProvider(provider);
}
-void Mixer::MixAndPublish(bool is_voice_query,
+void Mixer::MixAndPublish(bool is_empty_query,
+ bool is_voice_query,
const KnownResults& known_results) {
FetchResults(is_voice_query, known_results);
+ size_t num_max_results = is_empty_query ? kNumStartPageTiles : kMinResults;
xiyuan 2016/08/09 17:49:09 Can we move this logic out of Mixer and pass this
xdai1 2016/08/09 20:14:17 Done.
+
SortedResults results;
- results.reserve(kMinResults);
+ results.reserve(num_max_results);
// Add results from each group. Limit to the maximum number of results in each
// group.
@@ -159,7 +163,7 @@ void Mixer::MixAndPublish(bool is_voice_query,
RemoveDuplicates(&results);
std::sort(results.begin(), results.end());
- if (results.size() < kMinResults) {
+ if (results.size() < num_max_results) {
size_t original_size = results.size();
// We didn't get enough results. Insert all the results again, and this
// time, do not limit the maximum number of results from each group. (This

Powered by Google App Engine
This is Rietveld 408576698