Index: chrome/browser/ui/app_list/search/omnibox_provider.cc |
diff --git a/chrome/browser/ui/app_list/search/omnibox_provider.cc b/chrome/browser/ui/app_list/search/omnibox_provider.cc |
index e9f990d96275bd8b9b675c9345ed966013bbe977..52c8c9ad64aef7317f3962f2da90f064a0bea36b 100644 |
--- a/chrome/browser/ui/app_list/search/omnibox_provider.cc |
+++ b/chrome/browser/ui/app_list/search/omnibox_provider.cc |
@@ -47,21 +47,20 @@ void OmniboxProvider::Stop() { |
} |
void OmniboxProvider::PopulateFromACResult(const AutocompleteResult& result) { |
- ClearResults(); |
- for (ACMatches::const_iterator it = result.begin(); |
- it != result.end(); |
- ++it) { |
- if (!it->destination_url.is_valid()) |
+ SearchProvider::Results new_results; |
+ new_results.reserve(result.size()); |
+ for (const AutocompleteMatch& match : result) { |
+ if (!match.destination_url.is_valid()) |
continue; |
- Add(std::unique_ptr<SearchResult>(new OmniboxResult( |
- profile_, list_controller_, controller_.get(), is_voice_query_, *it))); |
+ new_results.emplace_back(base::MakeUnique<OmniboxResult>( |
+ profile_, list_controller_, controller_.get(), is_voice_query_, match)); |
} |
+ SwapResults(&new_results); |
} |
void OmniboxProvider::OnResultChanged(bool default_match_changed) { |
- const AutocompleteResult& result = controller_->result(); |
- PopulateFromACResult(result); |
+ PopulateFromACResult(controller_->result()); |
} |
} // namespace app_list |