Commit ea62ddbb authored by Leonard Grey's avatar Leonard Grey Committed by Commit Bot

Commander: limit number of returned results

Bug: 1014639
Change-Id: I689f97f57f07b1337df616cdf4621234bbd10841
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2518246
Commit-Queue: Avi Drissman <avi@chromium.org>
Auto-Submit: Leonard Grey <lgrey@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#824027}
parent c0f68e37
...@@ -15,6 +15,8 @@ namespace commander { ...@@ -15,6 +15,8 @@ namespace commander {
namespace { namespace {
size_t constexpr kMaxResults = 8;
CommanderController::CommandSources CreateDefaultSources() { CommanderController::CommandSources CreateDefaultSources() {
CommanderController::CommandSources sources; CommanderController::CommandSources sources;
sources.push_back(std::make_unique<SimpleCommandSource>()); sources.push_back(std::make_unique<SimpleCommandSource>());
...@@ -58,7 +60,8 @@ void CommanderController::OnTextChanged(const base::string16& text, ...@@ -58,7 +60,8 @@ void CommanderController::OnTextChanged(const base::string16& text,
const std::unique_ptr<CommandItem>& right) { const std::unique_ptr<CommandItem>& right) {
return left->score > right->score; return left->score > right->score;
}); });
// TODO(lgrey): Threshold this at some kind of max items. if (items.size() > kMaxResults)
items.resize(kMaxResults);
current_items_ = std::move(items); current_items_ = std::move(items);
CommanderViewModel vm; CommanderViewModel vm;
vm.result_set_id = ++current_result_set_id_; vm.result_set_id = ++current_result_set_id_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment