summaryrefslogtreecommitdiffstats
path: root/chrome/browser/importer
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-23 18:40:26 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-23 18:40:26 +0000
commit16fca9b8a9e129a2bc50bc39fa3d2b33db64efdb (patch)
tree09d56d4b75a0651a3ad4f82a4111c2943af772a1 /chrome/browser/importer
parent5284ee3d4b255ba50147550b5de9df85fc71076d (diff)
downloadchromium_src-16fca9b8a9e129a2bc50bc39fa3d2b33db64efdb.zip
chromium_src-16fca9b8a9e129a2bc50bc39fa3d2b33db64efdb.tar.gz
chromium_src-16fca9b8a9e129a2bc50bc39fa3d2b33db64efdb.tar.bz2
Add a Profile* member to TemplateURL. This makes some invocations of ReplaceSearchTerms() a bit less verbose, and will be useful later when UIThreadSearchTermsData starts taking a Profile*.
One downside is that there are a number of const_cast<>()s added when we try to access the profile() of a const TemplateURL*. These will all go away soon when TemplateURLService is switched to using "const" much less, so I didn't worry too much about them. BUG=none TEST=none Review URL: https://chromiumcodereview.appspot.com/10173001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133483 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/importer')
-rw-r--r--chrome/browser/importer/firefox2_importer.cc2
-rw-r--r--chrome/browser/importer/ie_importer.cc2
-rw-r--r--chrome/browser/importer/profile_import_process_messages.h5
-rw-r--r--chrome/browser/importer/profile_writer.cc4
4 files changed, 8 insertions, 5 deletions
diff --git a/chrome/browser/importer/firefox2_importer.cc b/chrome/browser/importer/firefox2_importer.cc
index 91bb725..09063ed 100644
--- a/chrome/browser/importer/firefox2_importer.cc
+++ b/chrome/browser/importer/firefox2_importer.cc
@@ -140,7 +140,7 @@ TemplateURL* Firefox2Importer::CreateTemplateURL(const string16& title,
data.short_name = title.empty() ? keyword : title;
data.SetKeyword(keyword);
data.SetURL(TemplateURLRef::DisplayURLToURLRef(UTF8ToUTF16(url.spec())));
- return new TemplateURL(data);
+ return new TemplateURL(NULL, data);
}
// static
diff --git a/chrome/browser/importer/ie_importer.cc b/chrome/browser/importer/ie_importer.cc
index 0730fb8..93fde8c 100644
--- a/chrome/browser/importer/ie_importer.cc
+++ b/chrome/browser/importer/ie_importer.cc
@@ -590,7 +590,7 @@ void IEImporter::ImportSearchEngines() {
data.SetURL(url);
data.show_in_default_list = true;
t_iter = search_engines_map.insert(std::make_pair(url,
- new TemplateURL(data))).first;
+ new TemplateURL(NULL, data))).first;
}
}
}
diff --git a/chrome/browser/importer/profile_import_process_messages.h b/chrome/browser/importer/profile_import_process_messages.h
index 0c49109..93f62d0 100644
--- a/chrome/browser/importer/profile_import_process_messages.h
+++ b/chrome/browser/importer/profile_import_process_messages.h
@@ -261,7 +261,10 @@ struct ParamTraits<TemplateURL*> {
TemplateURLData data;
if (!ReadParam(m, iter, &data))
return false;
- *p = new TemplateURL(data);
+ // Since we don't have access to a Profile*, just supply NULL. The caller
+ // can create a new TemplateURL or modify this one (e.g. via
+ // TemplateURLService::AddAndSetProfile()) to correct this later.
+ *p = new TemplateURL(NULL, data);
return true;
}
static void Log(const param_type& p, std::string* l) {
diff --git a/chrome/browser/importer/profile_writer.cc b/chrome/browser/importer/profile_writer.cc
index ee478a0..2450e58 100644
--- a/chrome/browser/importer/profile_writer.cc
+++ b/chrome/browser/importer/profile_writer.cc
@@ -316,8 +316,8 @@ void ProfileWriter::AddKeywords(ScopedVector<TemplateURL> template_urls,
// Only add valid TemplateURLs to the model.
if ((*i)->url_ref().IsValid()) {
- model->Add(*i); // Takes ownership.
- *i = NULL; // Prevent the vector from deleting *i later.
+ model->AddAndSetProfile(*i, profile_); // Takes ownership.
+ *i = NULL; // Prevent the vector from deleting *i later.
}
}
}