Index: chrome/browser/autocomplete/autocomplete_controller.cc |
diff --git a/chrome/browser/autocomplete/autocomplete_controller.cc b/chrome/browser/autocomplete/autocomplete_controller.cc |
index 062b9c13d6f85e52d7e2e9a914b5cfa22bc39985..8cdccbd932d04e39b9aafd31949f6fd78409ef28 100644 |
--- a/chrome/browser/autocomplete/autocomplete_controller.cc |
+++ b/chrome/browser/autocomplete/autocomplete_controller.cc |
@@ -24,7 +24,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/search_engines/template_url_service.h" |
+#include "chrome/browser/profiles/profile.h" |
+#include "chrome/browser/search_engines/ui_thread_search_terms_data.h" |
#include "components/search_engines/template_url.h" |
#include "content/public/browser/notification_service.h" |
#include "grit/generated_resources.h" |
@@ -169,7 +170,6 @@ |
AutocompleteController::AutocompleteController( |
Profile* profile, |
- TemplateURLService* template_url_service, |
AutocompleteControllerDelegate* delegate, |
int provider_types) |
: delegate_(delegate), |
@@ -180,7 +180,7 @@ |
stop_timer_duration_(OmniboxFieldTrial::StopTimerFieldTrialDuration()), |
done_(true), |
in_start_(false), |
- template_url_service_(template_url_service) { |
+ profile_(profile) { |
provider_types &= ~OmniboxFieldTrial::GetDisabledProviderTypes(); |
if (provider_types & AutocompleteProvider::TYPE_BOOKMARK) |
providers_.push_back(new BookmarkProvider(this, profile)); |
@@ -402,8 +402,7 @@ |
void AutocompleteController::UpdateMatchDestinationURL( |
base::TimeDelta query_formulation_time, |
AutocompleteMatch* match) const { |
- TemplateURL* template_url = match->GetTemplateURL( |
- template_url_service_, false); |
+ TemplateURL* template_url = match->GetTemplateURL(profile_, false); |
if (!template_url || !match->search_terms_args.get() || |
match->search_terms_args->assisted_query_stats.empty()) |
return; |
@@ -421,7 +420,7 @@ |
zero_suggest_provider_->field_trial_triggered_in_session()), |
input_.current_page_classification()); |
match->destination_url = GURL(template_url->url_ref().ReplaceSearchTerms( |
- search_terms_args, template_url_service_->search_terms_data())); |
+ search_terms_args, UIThreadSearchTermsData(profile_))); |
} |
void AutocompleteController::UpdateResult( |
@@ -451,7 +450,7 @@ |
result_.AppendMatches((*i)->matches()); |
// Sort the matches and trim to a small number of "best" matches. |
- result_.SortAndCull(input_, template_url_service_); |
+ result_.SortAndCull(input_, profile_); |
// Need to validate before invoking CopyOldMatches as the old matches are not |
// valid against the current input. |
@@ -462,7 +461,7 @@ |
if (!done_) { |
// This conditional needs to match the conditional in Start that invokes |
// StartExpireTimer. |
- result_.CopyOldMatches(input_, last_result, template_url_service_); |
+ result_.CopyOldMatches(input_, last_result, profile_); |
} |
UpdateKeywordDescriptions(&result_); |
@@ -507,7 +506,7 @@ |
for (ACMatches::iterator match(result->begin()); match != result->end(); |
++match) { |
base::string16 keyword( |
- match->GetSubstitutingExplicitlyInvokedKeyword(template_url_service_)); |
+ match->GetSubstitutingExplicitlyInvokedKeyword(profile_)); |
if (!keyword.empty()) { |
keywords.insert(keyword); |
continue; |
@@ -543,8 +542,7 @@ |
i->description_class.clear(); |
DCHECK(!i->keyword.empty()); |
if (i->keyword != last_keyword) { |
- const TemplateURL* template_url = |
- i->GetTemplateURL(template_url_service_, false); |
+ const TemplateURL* template_url = i->GetTemplateURL(profile_, false); |
if (template_url) { |
// For extension keywords, just make the description the extension |
// name -- don't assume that the normal search keyword description is |
@@ -597,8 +595,7 @@ |
// 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(template_url_service_, false); |
+ const TemplateURL* template_url = match->GetTemplateURL(profile_, false); |
if (!template_url || !match->search_terms_args.get()) |
continue; |
std::string selected_index; |
@@ -610,7 +607,7 @@ |
selected_index.c_str(), |
autocompletions.c_str()); |
match->destination_url = GURL(template_url->url_ref().ReplaceSearchTerms( |
- *match->search_terms_args, template_url_service_->search_terms_data())); |
+ *match->search_terms_args, UIThreadSearchTermsData(profile_))); |
} |
} |