| Index: chrome/browser/autocomplete/autocomplete_controller.cc
|
| diff --git a/chrome/browser/autocomplete/autocomplete_controller.cc b/chrome/browser/autocomplete/autocomplete_controller.cc
|
| index 951990045fb54e2168a734ec9f733b0236984d81..262f36739a0c33350e09b65d72e2e9fd246825a5 100644
|
| --- a/chrome/browser/autocomplete/autocomplete_controller.cc
|
| +++ b/chrome/browser/autocomplete/autocomplete_controller.cc
|
| @@ -25,9 +25,8 @@
|
| #include "chrome/browser/autocomplete/zero_suggest_provider.h"
|
| #include "chrome/browser/chrome_notification_types.h"
|
| #include "chrome/browser/omnibox/omnibox_field_trial.h"
|
| -#include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/search/search.h"
|
| -#include "chrome/browser/search_engines/ui_thread_search_terms_data.h"
|
| +#include "chrome/browser/search_engines/template_url_service.h"
|
| #include "components/search_engines/template_url.h"
|
| #include "content/public/browser/notification_service.h"
|
| #include "grit/generated_resources.h"
|
| @@ -173,7 +172,8 @@ bool AutocompleteMatchHasCustomDescription(const AutocompleteMatch& match) {
|
| AutocompleteController::AutocompleteController(
|
| Profile* profile,
|
| AutocompleteControllerDelegate* delegate,
|
| - int provider_types)
|
| + int provider_types,
|
| + TemplateURLService* template_url_service)
|
| : delegate_(delegate),
|
| history_url_provider_(NULL),
|
| keyword_provider_(NULL),
|
| @@ -182,7 +182,7 @@ AutocompleteController::AutocompleteController(
|
| stop_timer_duration_(OmniboxFieldTrial::StopTimerFieldTrialDuration()),
|
| done_(true),
|
| in_start_(false),
|
| - profile_(profile) {
|
| + template_url_service_(template_url_service) {
|
| provider_types &= ~OmniboxFieldTrial::GetDisabledProviderTypes();
|
| if (provider_types & AutocompleteProvider::TYPE_BOOKMARK)
|
| providers_.push_back(new BookmarkProvider(this, profile));
|
| @@ -406,7 +406,8 @@ void AutocompleteController::ResetSession() {
|
| void AutocompleteController::UpdateMatchDestinationURL(
|
| base::TimeDelta query_formulation_time,
|
| AutocompleteMatch* match) const {
|
| - TemplateURL* template_url = match->GetTemplateURL(profile_, false);
|
| + TemplateURL* template_url = match->GetTemplateURL(
|
| + template_url_service_, false);
|
| if (!template_url || !match->search_terms_args.get() ||
|
| match->search_terms_args->assisted_query_stats.empty())
|
| return;
|
| @@ -424,7 +425,7 @@ void AutocompleteController::UpdateMatchDestinationURL(
|
| zero_suggest_provider_->field_trial_triggered_in_session()),
|
| input_.current_page_classification());
|
| match->destination_url = GURL(template_url->url_ref().ReplaceSearchTerms(
|
| - search_terms_args, UIThreadSearchTermsData(profile_)));
|
| + search_terms_args, template_url_service_->search_terms_data()));
|
| }
|
|
|
| void AutocompleteController::UpdateResult(
|
| @@ -454,7 +455,7 @@ void AutocompleteController::UpdateResult(
|
| result_.AppendMatches((*i)->matches());
|
|
|
| // Sort the matches and trim to a small number of "best" matches.
|
| - result_.SortAndCull(input_, profile_);
|
| + result_.SortAndCull(input_, template_url_service_);
|
|
|
| // Need to validate before invoking CopyOldMatches as the old matches are not
|
| // valid against the current input.
|
| @@ -465,7 +466,7 @@ void AutocompleteController::UpdateResult(
|
| if (!done_) {
|
| // This conditional needs to match the conditional in Start that invokes
|
| // StartExpireTimer.
|
| - result_.CopyOldMatches(input_, last_result, profile_);
|
| + result_.CopyOldMatches(input_, last_result, template_url_service_);
|
| }
|
|
|
| UpdateKeywordDescriptions(&result_);
|
| @@ -510,7 +511,7 @@ void AutocompleteController::UpdateAssociatedKeywords(
|
| for (ACMatches::iterator match(result->begin()); match != result->end();
|
| ++match) {
|
| base::string16 keyword(
|
| - match->GetSubstitutingExplicitlyInvokedKeyword(profile_));
|
| + match->GetSubstitutingExplicitlyInvokedKeyword(template_url_service_));
|
| if (!keyword.empty()) {
|
| keywords.insert(keyword);
|
| continue;
|
| @@ -546,7 +547,8 @@ void AutocompleteController::UpdateKeywordDescriptions(
|
| i->description_class.clear();
|
| DCHECK(!i->keyword.empty());
|
| if (i->keyword != last_keyword) {
|
| - const TemplateURL* template_url = i->GetTemplateURL(profile_, false);
|
| + const TemplateURL* template_url =
|
| + i->GetTemplateURL(template_url_service_, false);
|
| if (template_url) {
|
| // For extension keywords, just make the description the extension
|
| // name -- don't assume that the normal search keyword description is
|
| @@ -599,7 +601,8 @@ void AutocompleteController::UpdateAssistedQueryStats(
|
| // Go over all matches and set AQS if the match supports it.
|
| for (size_t index = 0; index < result->size(); ++index) {
|
| AutocompleteMatch* match = result->match_at(index);
|
| - const TemplateURL* template_url = match->GetTemplateURL(profile_, false);
|
| + const TemplateURL* template_url =
|
| + match->GetTemplateURL(template_url_service_, false);
|
| if (!template_url || !match->search_terms_args.get())
|
| continue;
|
| std::string selected_index;
|
| @@ -611,7 +614,7 @@ void AutocompleteController::UpdateAssistedQueryStats(
|
| selected_index.c_str(),
|
| autocompletions.c_str());
|
| match->destination_url = GURL(template_url->url_ref().ReplaceSearchTerms(
|
| - *match->search_terms_args, UIThreadSearchTermsData(profile_)));
|
| + *match->search_terms_args, template_url_service_->search_terms_data()));
|
| }
|
| }
|
|
|
|
|