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

Unified Diff: chrome/browser/importer/profile_writer.cc

Issue 7558014: Add a URL param to indicate group selection in Instant field trial. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Passing NULL as far as possible Created 9 years, 4 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
Index: chrome/browser/importer/profile_writer.cc
diff --git a/chrome/browser/importer/profile_writer.cc b/chrome/browser/importer/profile_writer.cc
index 087707bda02157ad88302e020d70074e1a9ac50f..efd622df5986d7b857fff64ee64da4d5b5a36b27 100644
--- a/chrome/browser/importer/profile_writer.cc
+++ b/chrome/browser/importer/profile_writer.cc
@@ -241,7 +241,8 @@ static std::string HostPathKeyForURL(const GURL& url) {
// matches our prepopulate data. IE's URL for Live Search is something like
// 'http://...{Language}...'. As {Language} is not a valid OSDD parameter value
// the TemplateURL is invalid.
-static std::string BuildHostPathKey(const TemplateURL* t_url,
+static std::string BuildHostPathKey(Profile* profile,
+ const TemplateURL* t_url,
bool try_url_if_invalid) {
if (t_url->url()) {
if (try_url_if_invalid && !t_url->url()->IsValid())
@@ -250,7 +251,7 @@ static std::string BuildHostPathKey(const TemplateURL* t_url,
if (t_url->url()->SupportsReplacement()) {
return HostPathKeyForURL(GURL(
t_url->url()->ReplaceSearchTerms(
- *t_url, ASCIIToUTF16("random string"),
+ profile, *t_url, ASCIIToUTF16("random string"),
Peter Kasting 2011/08/11 00:35:17 HostPathKeyForURL() strips the query params so thi
TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16())));
}
}
@@ -259,11 +260,13 @@ static std::string BuildHostPathKey(const TemplateURL* t_url,
// Builds a set that contains an entry of the host+path for each TemplateURL in
// the TemplateURLService that has a valid search url.
-static void BuildHostPathMap(const TemplateURLService& model,
+static void BuildHostPathMap(Profile* profile,
+ const TemplateURLService& model,
HostPathMap* host_path_map) {
std::vector<const TemplateURL*> template_urls = model.GetTemplateURLs();
for (size_t i = 0; i < template_urls.size(); ++i) {
- const std::string host_path = BuildHostPathKey(template_urls[i], false);
+ const std::string host_path = BuildHostPathKey(profile, template_urls[i],
+ false);
if (!host_path.empty()) {
const TemplateURL* existing_turl = (*host_path_map)[host_path];
if (!existing_turl ||
@@ -287,7 +290,7 @@ void ProfileWriter::AddKeywords(const std::vector<TemplateURL*>& template_urls,
TemplateURLServiceFactory::GetForProfile(profile_);
HostPathMap host_path_map;
if (unique_on_host_and_path)
- BuildHostPathMap(*model, &host_path_map);
+ BuildHostPathMap(profile_, *model, &host_path_map);
for (std::vector<TemplateURL*>::const_iterator i = template_urls.begin();
i != template_urls.end(); ++i) {
@@ -314,10 +317,10 @@ void ProfileWriter::AddKeywords(const std::vector<TemplateURL*>& template_urls,
// imported browser.
if (unique_on_host_and_path &&
host_path_map.find(
- BuildHostPathKey(t_url, true)) != host_path_map.end()) {
+ BuildHostPathKey(profile_, t_url, true)) != host_path_map.end()) {
if (default_keyword) {
const TemplateURL* turl_with_host_path =
- host_path_map[BuildHostPathKey(t_url, true)];
+ host_path_map[BuildHostPathKey(profile_, t_url, true)];
if (turl_with_host_path)
model->SetDefaultSearchProvider(turl_with_host_path);
else

Powered by Google App Engine
This is Rietveld 408576698