Reland r130431: Move the URL string from TemplateURLRef onto the owning TemplateURL. This will make it easier to move the data members of TemplateURL into a new class later.
This changes the accessors for TemplateURL's TemplateURLRefs. There are now separate accessors for the URLs as strings and as TemplateURLRefs, and the latter have changed to returning a const ref, meaning they no longer return NULL when the corresponding URL string is empty. This makes a number of callers clearer.
This differs from r130431 only by including changes to fix the compile on official builds, which enable some #ifdefs that guarded additional points that needed migrating.
BUG=none
TEST=none
TBR=sky,mnissler,atwilson
Review URL: https://chromiumcodereview.appspot.com/9960016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130660 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc
index 3770635..078947c 100644
--- a/chrome/browser/autocomplete/search_provider.cc
+++ b/chrome/browser/autocomplete/search_provider.cc
@@ -455,10 +455,10 @@
int id,
const TemplateURL& provider,
const string16& text) {
- const TemplateURLRef* const suggestions_url = provider.suggestions_url();
- DCHECK(suggestions_url->SupportsReplacement());
+ const TemplateURLRef& suggestions_url = provider.suggestions_url_ref();
+ DCHECK(suggestions_url.SupportsReplacement());
content::URLFetcher* fetcher = content::URLFetcher::Create(id,
- GURL(suggestions_url->ReplaceSearchTermsUsingProfile(
+ GURL(suggestions_url.ReplaceSearchTermsUsingProfile(
profile_, text, TemplateURLRef::NO_SUGGESTIONS_AVAILABLE,
string16())),
content::URLFetcher::GET, this);
@@ -901,9 +901,9 @@
input_text))
match.inline_autocomplete_offset = search_start + input_text.length();
- const TemplateURLRef* const search_url = provider.url();
- DCHECK(search_url->SupportsReplacement());
- match.destination_url = GURL(search_url->ReplaceSearchTermsUsingProfile(
+ const TemplateURLRef& search_url = provider.url_ref();
+ DCHECK(search_url.SupportsReplacement());
+ match.destination_url = GURL(search_url.ReplaceSearchTermsUsingProfile(
profile_, query_string, accepted_suggestion, input_text));
// Search results don't look like URLs.