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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
255 // matches our prepopulate data. IE's URL for Live Search is something like | 255 // matches our prepopulate data. IE's URL for Live Search is something like |
256 // 'http://...{Language}...'. As {Language} is not a valid OSDD parameter value | 256 // 'http://...{Language}...'. As {Language} is not a valid OSDD parameter value |
257 // the TemplateURL is invalid. | 257 // the TemplateURL is invalid. |
258 static std::string BuildHostPathKey(const TemplateURL* t_url, | 258 static std::string BuildHostPathKey(const TemplateURL* t_url, |
259 bool try_url_if_invalid) { | 259 bool try_url_if_invalid) { |
260 if (try_url_if_invalid && !t_url->url_ref().IsValid()) | 260 if (try_url_if_invalid && !t_url->url_ref().IsValid()) |
261 return HostPathKeyForURL(GURL(t_url->url())); | 261 return HostPathKeyForURL(GURL(t_url->url())); |
262 | 262 |
263 if (t_url->url_ref().SupportsReplacement()) { | 263 if (t_url->url_ref().SupportsReplacement()) { |
264 return HostPathKeyForURL(GURL( | 264 return HostPathKeyForURL(GURL( |
265 t_url->url_ref().ReplaceSearchTerms(ASCIIToUTF16("x"), | 265 t_url->url_ref().ReplaceSearchTerms( |
Peter Kasting
2012/06/16 03:14:17
Nit: This may fit on the prior line
Bart N
2012/06/16 23:38:10
Not anymore.
| |
266 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16()))); | 266 SearchTermsArgs(ASCIIToUTF16("x"))))); |
267 } | 267 } |
268 return std::string(); | 268 return std::string(); |
269 } | 269 } |
270 | 270 |
271 // Builds a set that contains an entry of the host+path for each TemplateURL in | 271 // Builds a set that contains an entry of the host+path for each TemplateURL in |
272 // the TemplateURLService that has a valid search url. | 272 // the TemplateURLService that has a valid search url. |
273 static void BuildHostPathMap(TemplateURLService* model, | 273 static void BuildHostPathMap(TemplateURLService* model, |
274 HostPathMap* host_path_map) { | 274 HostPathMap* host_path_map) { |
275 TemplateURLService::TemplateURLVector template_urls = | 275 TemplateURLService::TemplateURLVector template_urls = |
276 model->GetTemplateURLs(); | 276 model->GetTemplateURLs(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
318 | 318 |
319 // Only add valid TemplateURLs to the model. | 319 // Only add valid TemplateURLs to the model. |
320 if ((*i)->url_ref().IsValid()) { | 320 if ((*i)->url_ref().IsValid()) { |
321 model->AddAndSetProfile(*i, profile_); // Takes ownership. | 321 model->AddAndSetProfile(*i, profile_); // Takes ownership. |
322 *i = NULL; // Prevent the vector from deleting *i later. | 322 *i = NULL; // Prevent the vector from deleting *i later. |
323 } | 323 } |
324 } | 324 } |
325 } | 325 } |
326 | 326 |
327 ProfileWriter::~ProfileWriter() {} | 327 ProfileWriter::~ProfileWriter() {} |
OLD | NEW |