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

Unified Diff: chrome/browser/autocomplete/history_quick_provider.cc

Issue 903493002: Componentize ScoredHistoryMatch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 10 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: chrome/browser/autocomplete/history_quick_provider.cc
diff --git a/chrome/browser/autocomplete/history_quick_provider.cc b/chrome/browser/autocomplete/history_quick_provider.cc
index 9ec108dc9be85330da2cecfa983496e50c8ea3b8..3e2f9894fe1fe8b8a38e04ed6eba48ab58d31e43 100644
--- a/chrome/browser/autocomplete/history_quick_provider.cc
+++ b/chrome/browser/autocomplete/history_quick_provider.cc
@@ -19,17 +19,20 @@
#include "base/time/time.h"
#include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h"
#include "chrome/browser/autocomplete/history_url_provider.h"
+#include "chrome/browser/bookmarks/bookmark_model_factory.h"
+#include "chrome/browser/history/chrome_scored_history_match_client.h"
#include "chrome/browser/history/history_service.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/history/in_memory_url_index.h"
-#include "chrome/browser/history/scored_history_match.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
+#include "components/bookmarks/browser/bookmark_model.h"
#include "components/history/core/browser/history_database.h"
#include "components/history/core/browser/in_memory_url_index_types.h"
+#include "components/history/core/browser/scored_history_match.h"
#include "components/metrics/proto/omnibox_input_type.pb.h"
#include "components/omnibox/autocomplete_match_type.h"
#include "components/omnibox/autocomplete_result.h"
@@ -93,7 +96,8 @@ void HistoryQuickProvider::DoAutocomplete() {
ScoredHistoryMatches matches = GetIndex()->HistoryItemsForTerms(
autocomplete_input_.text(),
autocomplete_input_.cursor_position(),
- AutocompleteProvider::kMaxMatches);
+ AutocompleteProvider::kMaxMatches,
+ GetScoredHistoryMatchClient());
if (matches.empty())
return;
@@ -299,3 +303,12 @@ history::InMemoryURLIndex* HistoryQuickProvider::GetIndex() {
return history_service->InMemoryIndex();
}
+
+const history::ScoredHistoryMatchClient*
+HistoryQuickProvider::GetScoredHistoryMatchClient() {
+ if (!scored_history_match_client_) {
+ scored_history_match_client_.reset(new ChromeScoredHistoryMatchClient(
+ BookmarkModelFactory::GetForProfile(profile_)));
+ }
+ return scored_history_match_client_.get();
+}
« no previous file with comments | « chrome/browser/autocomplete/history_quick_provider.h ('k') | chrome/browser/autocomplete/history_url_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698