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

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

Issue 1185723002: Prepare HistoryProvider for componentization (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Response to review Created 5 years, 6 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_provider.cc
diff --git a/chrome/browser/autocomplete/history_provider.cc b/chrome/browser/autocomplete/history_provider.cc
index a0bfa79d1435e48732acc6faddd4889a64ab0d76..32b965b8aaf3a9526cd197fe100e9848dedfdb3e 100644
--- a/chrome/browser/autocomplete/history_provider.cc
+++ b/chrome/browser/autocomplete/history_provider.cc
@@ -8,10 +8,6 @@
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/bookmarks/bookmark_model_factory.h"
-#include "chrome/browser/history/history_service_factory.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/common/url_constants.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/history/core/browser/history_service.h"
#include "components/omnibox/autocomplete_input.h"
@@ -23,12 +19,10 @@ using bookmarks::BookmarkModel;
void HistoryProvider::DeleteMatch(const AutocompleteMatch& match) {
DCHECK(done_);
- DCHECK(profile_);
+ DCHECK(client_);
DCHECK(match.deletable);
- history::HistoryService* const history_service =
- HistoryServiceFactory::GetForProfile(profile_,
- ServiceAccessType::EXPLICIT_ACCESS);
+ history::HistoryService* const history_service = client_->HistoryService();
// Delete the underlying URL along with all its visits from the history DB.
// The resulting HISTORY_URLS_DELETED notification will also cause all caches
@@ -48,17 +42,16 @@ bool HistoryProvider::PreventInlineAutocomplete(
IsWhitespace(input.text()[input.text().length() - 1]));
}
-HistoryProvider::HistoryProvider(Profile* profile,
- AutocompleteProvider::Type type)
- : AutocompleteProvider(type),
- profile_(profile) {
+HistoryProvider::HistoryProvider(AutocompleteProvider::Type type,
+ AutocompleteProviderClient* client)
+ : AutocompleteProvider(type), client_(client) {
}
HistoryProvider::~HistoryProvider() {}
void HistoryProvider::DeleteMatchFromMatches(const AutocompleteMatch& match) {
bool found = false;
- BookmarkModel* bookmark_model = BookmarkModelFactory::GetForProfile(profile_);
+ BookmarkModel* bookmark_model = client_->BookmarkModel();
for (ACMatches::iterator i(matches_.begin()); i != matches_.end(); ++i) {
if (i->destination_url == match.destination_url && i->type == match.type) {
found = true;
« no previous file with comments | « chrome/browser/autocomplete/history_provider.h ('k') | chrome/browser/autocomplete/history_quick_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698