summaryrefslogtreecommitdiffstats
path: root/chrome/browser/importer/profile_writer.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-03 19:28:32 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-03 19:28:32 +0000
commitc551eab78ed90d864c0a289c229a87e25be5a6ce (patch)
tree8ae88c97308073fafc0da78f8cd176c82c19a544 /chrome/browser/importer/profile_writer.cc
parentda965a2d2466edef79e9b6bd3f8c3668f6b7a52f (diff)
downloadchromium_src-c551eab78ed90d864c0a289c229a87e25be5a6ce.zip
chromium_src-c551eab78ed90d864c0a289c229a87e25be5a6ce.tar.gz
chromium_src-c551eab78ed90d864c0a289c229a87e25be5a6ce.tar.bz2
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. BUG=none TEST=none Review URL: https://chromiumcodereview.appspot.com/9968016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130431 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/importer/profile_writer.cc')
-rw-r--r--chrome/browser/importer/profile_writer.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/chrome/browser/importer/profile_writer.cc b/chrome/browser/importer/profile_writer.cc
index 2102067..bf81c3bc 100644
--- a/chrome/browser/importer/profile_writer.cc
+++ b/chrome/browser/importer/profile_writer.cc
@@ -255,13 +255,13 @@ static std::string HostPathKeyForURL(const GURL& url) {
// the TemplateURL is invalid.
static std::string BuildHostPathKey(const TemplateURL* t_url,
bool try_url_if_invalid) {
- if (t_url->url()) {
- if (try_url_if_invalid && !t_url->url()->IsValid())
- return HostPathKeyForURL(GURL(t_url->url()->url()));
+ if (!t_url->url().empty()) {
+ if (try_url_if_invalid && !t_url->url_ref().IsValid())
+ return HostPathKeyForURL(GURL(t_url->url()));
- if (t_url->url()->SupportsReplacement()) {
+ if (t_url->url_ref().SupportsReplacement()) {
return HostPathKeyForURL(GURL(
- t_url->url()->ReplaceSearchTerms(ASCIIToUTF16("x"),
+ t_url->url_ref().ReplaceSearchTerms(ASCIIToUTF16("x"),
TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16())));
}
}
@@ -317,7 +317,7 @@ void ProfileWriter::AddKeywords(ScopedVector<TemplateURL> template_urls,
continue;
// Only add valid TemplateURLs to the model.
- if ((*i)->url() && (*i)->url()->IsValid()) {
+ if (!(*i)->url().empty() && (*i)->url_ref().IsValid()) {
model->Add(*i); // Takes ownership.
*i = NULL; // Prevent the vector from deleting *i later.
}