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..4c04f9d7fb9218a19f8dba086eb19829daf0a487 100644 |
--- a/chrome/browser/autocomplete/autocomplete_controller.cc |
+++ b/chrome/browser/autocomplete/autocomplete_controller.cc |
@@ -27,6 +27,7 @@ |
#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/template_url_service_factory.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" |
@@ -406,7 +407,9 @@ void AutocompleteController::ResetSession() { |
void AutocompleteController::UpdateMatchDestinationURL( |
base::TimeDelta query_formulation_time, |
AutocompleteMatch* match) const { |
- TemplateURL* template_url = match->GetTemplateURL(profile_, false); |
+ TemplateURLService* service = |
+ TemplateURLServiceFactory::GetForProfile(profile_); |
blundell
2014/06/26 09:00:00
This class will eventually need to have the Templa
Jun Mukai
2014/06/26 21:01:19
Agree, it would be better to pass TemplateURLServi
|
+ TemplateURL* template_url = match->GetTemplateURL(service, false); |
if (!template_url || !match->search_terms_args.get() || |
match->search_terms_args->assisted_query_stats.empty()) |
return; |
@@ -453,8 +456,11 @@ void AutocompleteController::UpdateResult( |
i != providers_.end(); ++i) |
result_.AppendMatches((*i)->matches()); |
+ TemplateURLService* template_url_service = |
+ TemplateURLServiceFactory::GetForProfile(profile_); |
+ |
// 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 +471,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_); |
@@ -507,10 +513,12 @@ void AutocompleteController::UpdateAssociatedKeywords( |
return; |
std::set<base::string16> keywords; |
+ TemplateURLService* service = |
+ TemplateURLServiceFactory::GetForProfile(profile_); |
for (ACMatches::iterator match(result->begin()); match != result->end(); |
++match) { |
base::string16 keyword( |
- match->GetSubstitutingExplicitlyInvokedKeyword(profile_)); |
+ match->GetSubstitutingExplicitlyInvokedKeyword(service)); |
if (!keyword.empty()) { |
keywords.insert(keyword); |
continue; |
@@ -537,6 +545,8 @@ void AutocompleteController::UpdateAssociatedKeywords( |
void AutocompleteController::UpdateKeywordDescriptions( |
AutocompleteResult* result) { |
base::string16 last_keyword; |
+ TemplateURLService* service = |
+ TemplateURLServiceFactory::GetForProfile(profile_); |
for (AutocompleteResult::iterator i(result->begin()); i != result->end(); |
++i) { |
if (AutocompleteMatch::IsSearchType(i->type)) { |
@@ -546,7 +556,7 @@ 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(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 |
@@ -597,9 +607,11 @@ void AutocompleteController::UpdateAssistedQueryStats( |
AppendAvailableAutocompletion( |
last_type, last_subtype, count, &autocompletions); |
// Go over all matches and set AQS if the match supports it. |
+ TemplateURLService* service = |
+ TemplateURLServiceFactory::GetForProfile(profile_); |
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(service, false); |
if (!template_url || !match->search_terms_args.get()) |
continue; |
std::string selected_index; |