| Index: chrome/browser/autocomplete/keyword_provider.cc
|
| ===================================================================
|
| --- chrome/browser/autocomplete/keyword_provider.cc (revision 130285)
|
| +++ chrome/browser/autocomplete/keyword_provider.cc (working copy)
|
| @@ -364,16 +364,15 @@
|
| const TemplateURL* element,
|
| AutocompleteMatch* match) {
|
| DCHECK(!element->short_name().empty());
|
| - const TemplateURLRef* element_ref = element->url();
|
| - DCHECK(element_ref);
|
| - DCHECK(element_ref->IsValid());
|
| + const TemplateURLRef& element_ref = element->url_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,
|
| @@ -383,7 +382,7 @@
|
| ACMatchClassification(0, ACMatchClassification::DIM));
|
| } else {
|
| // Keyword that has no replacement text (aka a shorthand for a URL).
|
| - match->destination_url = GURL(element_ref->url());
|
| + match->destination_url = GURL(element->url());
|
| match->contents.assign(element->short_name());
|
| AutocompleteMatch::ClassifyLocationInString(0, match->contents.length(),
|
| match->contents.length(), ACMatchClassification::NONE,
|
| @@ -394,10 +393,10 @@
|
| // 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(),
|
| @@ -439,8 +438,8 @@
|
| // Get keyword data from data store.
|
| const TemplateURL* element(
|
| model->GetTemplateURLForKeyword(keyword));
|
| - DCHECK(element && element->url());
|
| - const bool supports_replacement = element->url()->SupportsReplacement();
|
| + DCHECK(element && !element->url().empty());
|
| + const bool supports_replacement = element->url_ref().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
|
|
|