summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete/keyword_provider.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/autocomplete/keyword_provider.cc')
-rw-r--r--chrome/browser/autocomplete/keyword_provider.cc21
1 files changed, 11 insertions, 10 deletions
diff --git a/chrome/browser/autocomplete/keyword_provider.cc b/chrome/browser/autocomplete/keyword_provider.cc
index 98ed031..68e7e9d 100644
--- a/chrome/browser/autocomplete/keyword_provider.cc
+++ b/chrome/browser/autocomplete/keyword_provider.cc
@@ -364,15 +364,16 @@ void KeywordProvider::FillInURLAndContents(
const TemplateURL* element,
AutocompleteMatch* match) {
DCHECK(!element->short_name().empty());
- const TemplateURLRef& element_ref = element->url_ref();
- DCHECK(element_ref.IsValid());
+ const TemplateURLRef* element_ref = element->url();
+ DCHECK(element_ref);
+ DCHECK(element_ref->IsValid());
int message_id = element->IsExtensionKeyword() ?
IDS_EXTENSION_KEYWORD_COMMAND : IDS_KEYWORD_SEARCH;
if (remaining_input.empty()) {
// Allow extension keyword providers to accept empty string input. This is
// useful to allow extensions to do something in the case where no input is
// entered.
- if (element_ref.SupportsReplacement() && !element->IsExtensionKeyword()) {
+ if (element_ref->SupportsReplacement() && !element->IsExtensionKeyword()) {
// No query input; return a generic, no-destination placeholder.
match->contents.assign(
l10n_util::GetStringFUTF16(message_id,
@@ -382,7 +383,7 @@ void KeywordProvider::FillInURLAndContents(
ACMatchClassification(0, ACMatchClassification::DIM));
} else {
// Keyword that has no replacement text (aka a shorthand for a URL).
- match->destination_url = GURL(element->url());
+ match->destination_url = GURL(element_ref->url());
match->contents.assign(element->short_name());
AutocompleteMatch::ClassifyLocationInString(0, match->contents.length(),
match->contents.length(), ACMatchClassification::NONE,
@@ -393,10 +394,10 @@ void KeywordProvider::FillInURLAndContents(
// keyword template URL. The escaping here handles whitespace in user
// input, but we rely on later canonicalization functions to do more
// fixup to make the URL valid if necessary.
- DCHECK(element_ref.SupportsReplacement());
- match->destination_url = GURL(element_ref.ReplaceSearchTermsUsingProfile(
- profile, remaining_input, TemplateURLRef::NO_SUGGESTIONS_AVAILABLE,
- string16()));
+ DCHECK(element_ref->SupportsReplacement());
+ match->destination_url = GURL(element_ref->
+ ReplaceSearchTermsUsingProfile(profile, remaining_input,
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16()));
std::vector<size_t> content_param_offsets;
match->contents.assign(l10n_util::GetStringFUTF16(message_id,
element->short_name(),
@@ -438,8 +439,8 @@ AutocompleteMatch KeywordProvider::CreateAutocompleteMatch(
// Get keyword data from data store.
const TemplateURL* element(
model->GetTemplateURLForKeyword(keyword));
- DCHECK(element && !element->url().empty());
- const bool supports_replacement = element->url_ref().SupportsReplacement();
+ DCHECK(element && element->url());
+ const bool supports_replacement = element->url()->SupportsReplacement();
// Create an edit entry of "[keyword] [remaining input]". This is helpful
// even when [remaining input] is empty, as the user can select the popup