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

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

Issue 1192373002: Prepare AutocompleteController for componentization (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@componentize_zero_suggest_provider
Patch Set: Remove stale include 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/autocomplete_controller.cc
diff --git a/chrome/browser/autocomplete/autocomplete_controller.cc b/chrome/browser/autocomplete/autocomplete_controller.cc
index a593007ec1e9b57b14d9d47caa222136b43f4565..1f5c2c97c1bb433573e246f3ff4d5f86c436db20 100644
--- a/chrome/browser/autocomplete/autocomplete_controller.cc
+++ b/chrome/browser/autocomplete/autocomplete_controller.cc
@@ -15,7 +15,6 @@
#include "base/time/time.h"
#include "chrome/browser/autocomplete/autocomplete_controller_delegate.h"
#include "chrome/browser/autocomplete/builtin_provider.h"
-#include "chrome/browser/autocomplete/in_memory_url_index_factory.h"
#include "chrome/browser/autocomplete/zero_suggest_provider.h"
#include "components/omnibox/bookmark_provider.h"
#include "components/omnibox/history_quick_provider.h"
@@ -29,10 +28,6 @@
#include "grit/components_strings.h"
#include "ui/base/l10n/l10n_util.h"
-#if defined(ENABLE_EXTENSIONS)
-#include "chrome/browser/autocomplete/keyword_extensions_delegate_impl.h"
-#endif
-
namespace {
// Converts the given match to a type (and possibly subtype) based on the AQS
@@ -166,12 +161,11 @@ bool AutocompleteMatchHasCustomDescription(const AutocompleteMatch& match) {
} // namespace
AutocompleteController::AutocompleteController(
- Profile* profile,
- TemplateURLService* template_url_service,
+ scoped_ptr<AutocompleteProviderClient> provider_client,
AutocompleteControllerDelegate* delegate,
int provider_types)
: delegate_(delegate),
- provider_client_(new ChromeAutocompleteProviderClient(profile)),
+ provider_client_(provider_client.Pass()),
history_url_provider_(NULL),
keyword_provider_(NULL),
search_provider_(NULL),
@@ -179,17 +173,16 @@ AutocompleteController::AutocompleteController(
stop_timer_duration_(OmniboxFieldTrial::StopTimerFieldTrialDuration()),
done_(true),
in_start_(false),
- template_url_service_(template_url_service) {
+ template_url_service_(provider_client_->GetTemplateURLService()) {
provider_types &= ~OmniboxFieldTrial::GetDisabledProviderTypes();
if (provider_types & AutocompleteProvider::TYPE_BOOKMARK)
providers_.push_back(new BookmarkProvider(provider_client_.get()));
if (provider_types & AutocompleteProvider::TYPE_BUILTIN)
providers_.push_back(new BuiltinProvider());
- if (provider_types & AutocompleteProvider::TYPE_HISTORY_QUICK) {
- providers_.push_back(new HistoryQuickProvider(
- provider_client_.get(),
- InMemoryURLIndexFactory::GetForProfile(profile)));
- }
+
+ if (provider_types & AutocompleteProvider::TYPE_HISTORY_QUICK)
Peter Kasting 2015/06/19 19:19:21 Nit: Why blank lines above and below this particul
blundell 2015/06/22 09:01:36 Done.
+ providers_.push_back(new HistoryQuickProvider(provider_client_.get()));
+
if (provider_types & AutocompleteProvider::TYPE_HISTORY_URL) {
history_url_provider_ =
new HistoryURLProvider(provider_client_.get(), this);
@@ -198,25 +191,21 @@ AutocompleteController::AutocompleteController(
// "Tab to search" can be used on all platforms other than Android.
#if !defined(OS_ANDROID)
if (provider_types & AutocompleteProvider::TYPE_KEYWORD) {
- keyword_provider_ = new KeywordProvider(this, template_url_service);
-#if defined(ENABLE_EXTENSIONS)
- keyword_provider_->set_extensions_delegate(
- scoped_ptr<KeywordExtensionsDelegate>(
- new KeywordExtensionsDelegateImpl(profile, keyword_provider_)));
-#endif
+ keyword_provider_ = new KeywordProvider(this, template_url_service_);
+ provider_client_->ConfigureKeywordProvider(keyword_provider_);
providers_.push_back(keyword_provider_);
}
#endif
if (provider_types & AutocompleteProvider::TYPE_SEARCH) {
search_provider_ =
- new SearchProvider(provider_client_.get(), this, template_url_service);
+ new SearchProvider(provider_client_.get(), this, template_url_service_);
providers_.push_back(search_provider_);
}
if (provider_types & AutocompleteProvider::TYPE_SHORTCUTS)
providers_.push_back(new ShortcutsProvider(provider_client_.get()));
if (provider_types & AutocompleteProvider::TYPE_ZERO_SUGGEST) {
zero_suggest_provider_ = ZeroSuggestProvider::Create(
- provider_client_.get(), this, template_url_service);
+ provider_client_.get(), this, template_url_service_);
if (zero_suggest_provider_)
providers_.push_back(zero_suggest_provider_);
}

Powered by Google App Engine
This is Rietveld 408576698