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

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: Fix 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..4592a608ce790b781983d786df7ba50cae60d821 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,
+HistoryProvider::HistoryProvider(scoped_ptr<AutocompleteProviderClient> client,
AutocompleteProvider::Type type)
- : AutocompleteProvider(type),
- profile_(profile) {
+ : AutocompleteProvider(type), client_(client.Pass()) {
Peter Kasting 2015/06/12 16:20:23 Tiny nit: I kinda feel like we should reverse the
blundell 2015/06/15 08:51:33 Done.
}
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;

Powered by Google App Engine
This is Rietveld 408576698