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

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

Issue 439243004: Stop depending on TemplateURLServiceFactory from SearchProvider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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/zero_suggest_provider.cc
diff --git a/chrome/browser/autocomplete/zero_suggest_provider.cc b/chrome/browser/autocomplete/zero_suggest_provider.cc
index f80d776b274fa0e03aaddb39fb0b26835836a7fd..768ca485b2a8e368e8ce6c3b03d757668ed38ba6 100644
--- a/chrome/browser/autocomplete/zero_suggest_provider.cc
+++ b/chrome/browser/autocomplete/zero_suggest_provider.cc
@@ -22,9 +22,7 @@
#include "chrome/browser/history/top_sites.h"
#include "chrome/browser/omnibox/omnibox_field_trial.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/url_constants.h"
#include "components/autocomplete/autocomplete_input.h"
#include "components/autocomplete/autocomplete_match.h"
#include "components/autocomplete/autocomplete_provider_listener.h"
@@ -76,8 +74,9 @@ const int kDefaultZeroSuggestRelevance = 100;
// static
ZeroSuggestProvider* ZeroSuggestProvider::Create(
AutocompleteProviderListener* listener,
+ TemplateURLService* template_url_service,
Profile* profile) {
- return new ZeroSuggestProvider(listener, profile);
+ return new ZeroSuggestProvider(listener, template_url_service, profile);
}
// static
@@ -118,7 +117,8 @@ void ZeroSuggestProvider::Start(const AutocompleteInput& input,
// No need to send the current page URL in personalized suggest field trial.
if (CanSendURL(input.current_url(), suggest_url, default_provider,
- current_page_classification_, profile_) &&
+ current_page_classification_,
+ template_url_service_->search_terms_data(), profile_) &&
!OmniboxFieldTrial::InZeroSuggestPersonalizedFieldTrial()) {
// Update suggest_url to include the current_page_url.
search_term_args.current_page_url = current_query_;
@@ -164,10 +164,10 @@ void ZeroSuggestProvider::ModifyProviderInfo(
ZeroSuggestProvider::ZeroSuggestProvider(
AutocompleteProviderListener* listener,
+ TemplateURLService* template_url_service,
Profile* profile)
- : BaseSearchProvider(listener, profile,
+ : BaseSearchProvider(listener, template_url_service, profile,
AutocompleteProvider::TYPE_ZERO_SUGGEST),
- template_url_service_(TemplateURLServiceFactory::GetForProfile(profile)),
results_from_cache_(false),
weak_ptr_factory_(this) {
}
@@ -428,7 +428,8 @@ bool ZeroSuggestProvider::CanShowZeroSuggestWithoutSendingURL(
const GURL& current_page_url) const {
if (!ZeroSuggestEnabled(suggest_url,
template_url_service_->GetDefaultSearchProvider(),
- current_page_classification_, profile_))
+ current_page_classification_,
+ template_url_service_->search_terms_data(), profile_))
return false;
// If we cannot send URLs, then only the MostVisited and Personalized
« no previous file with comments | « chrome/browser/autocomplete/zero_suggest_provider.h ('k') | chrome/browser/autocomplete/zero_suggest_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698