OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/importer/profile_writer.h" | 5 #include "chrome/browser/importer/profile_writer.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 // matches our prepopulate data. IE's URL for Live Search is something like | 256 // matches our prepopulate data. IE's URL for Live Search is something like |
257 // 'http://...{Language}...'. As {Language} is not a valid OSDD parameter value | 257 // 'http://...{Language}...'. As {Language} is not a valid OSDD parameter value |
258 // the TemplateURL is invalid. | 258 // the TemplateURL is invalid. |
259 static std::string BuildHostPathKey(const TemplateURL* t_url, | 259 static std::string BuildHostPathKey(const TemplateURL* t_url, |
260 bool try_url_if_invalid) { | 260 bool try_url_if_invalid) { |
261 if (try_url_if_invalid && !t_url->url_ref().IsValid()) | 261 if (try_url_if_invalid && !t_url->url_ref().IsValid()) |
262 return HostPathKeyForURL(GURL(t_url->url())); | 262 return HostPathKeyForURL(GURL(t_url->url())); |
263 | 263 |
264 if (t_url->url_ref().SupportsReplacement()) { | 264 if (t_url->url_ref().SupportsReplacement()) { |
265 return HostPathKeyForURL(GURL( | 265 return HostPathKeyForURL(GURL( |
266 t_url->url_ref().ReplaceSearchTerms(ASCIIToUTF16("x"), | 266 t_url->url_ref().ReplaceSearchTerms( |
267 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16()))); | 267 TemplateURLRef::SearchTermsArgs(ASCIIToUTF16("x"))))); |
268 } | 268 } |
269 return std::string(); | 269 return std::string(); |
270 } | 270 } |
271 | 271 |
272 // Builds a set that contains an entry of the host+path for each TemplateURL in | 272 // Builds a set that contains an entry of the host+path for each TemplateURL in |
273 // the TemplateURLService that has a valid search url. | 273 // the TemplateURLService that has a valid search url. |
274 static void BuildHostPathMap(TemplateURLService* model, | 274 static void BuildHostPathMap(TemplateURLService* model, |
275 HostPathMap* host_path_map) { | 275 HostPathMap* host_path_map) { |
276 TemplateURLService::TemplateURLVector template_urls = | 276 TemplateURLService::TemplateURLVector template_urls = |
277 model->GetTemplateURLs(); | 277 model->GetTemplateURLs(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 | 319 |
320 // Only add valid TemplateURLs to the model. | 320 // Only add valid TemplateURLs to the model. |
321 if ((*i)->url_ref().IsValid()) { | 321 if ((*i)->url_ref().IsValid()) { |
322 model->AddAndSetProfile(*i, profile_); // Takes ownership. | 322 model->AddAndSetProfile(*i, profile_); // Takes ownership. |
323 *i = NULL; // Prevent the vector from deleting *i later. | 323 *i = NULL; // Prevent the vector from deleting *i later. |
324 } | 324 } |
325 } | 325 } |
326 } | 326 } |
327 | 327 |
328 ProfileWriter::~ProfileWriter() {} | 328 ProfileWriter::~ProfileWriter() {} |
OLD | NEW |