Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Unified Diff: chrome/browser/autocomplete/keyword_provider.cc

Issue 9968016: Move the URL string from TemplateURLRef onto the owning TemplateURL. This will make it easier to m… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit.cc ('k') | chrome/browser/autocomplete/search_provider.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit.cc ('k') | chrome/browser/autocomplete/search_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698