OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/threading/thread.h" | 8 #include "base/threading/thread.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
11 #include "chrome/browser/importer/importer.h" | 11 #include "chrome/browser/importer/importer.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // the TemplateURL is invalid. | 174 // the TemplateURL is invalid. |
175 static std::string BuildHostPathKey(const TemplateURL* t_url, | 175 static std::string BuildHostPathKey(const TemplateURL* t_url, |
176 bool try_url_if_invalid) { | 176 bool try_url_if_invalid) { |
177 if (t_url->url()) { | 177 if (t_url->url()) { |
178 if (try_url_if_invalid && !t_url->url()->IsValid()) | 178 if (try_url_if_invalid && !t_url->url()->IsValid()) |
179 return HostPathKeyForURL(GURL(t_url->url()->url())); | 179 return HostPathKeyForURL(GURL(t_url->url()->url())); |
180 | 180 |
181 if (t_url->url()->SupportsReplacement()) { | 181 if (t_url->url()->SupportsReplacement()) { |
182 return HostPathKeyForURL(GURL( | 182 return HostPathKeyForURL(GURL( |
183 t_url->url()->ReplaceSearchTerms( | 183 t_url->url()->ReplaceSearchTerms( |
184 *t_url, L"random string", | 184 *t_url, ASCIIToUTF16("random string"), |
185 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring()))); | 185 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16()))); |
186 } | 186 } |
187 } | 187 } |
188 return std::string(); | 188 return std::string(); |
189 } | 189 } |
190 | 190 |
191 // Builds a set that contains an entry of the host+path for each TemplateURL in | 191 // Builds a set that contains an entry of the host+path for each TemplateURL in |
192 // the TemplateURLModel that has a valid search url. | 192 // the TemplateURLModel that has a valid search url. |
193 static void BuildHostPathMap(const TemplateURLModel& model, | 193 static void BuildHostPathMap(const TemplateURLModel& model, |
194 HostPathMap* host_path_map) { | 194 HostPathMap* host_path_map) { |
195 std::vector<const TemplateURL*> template_urls = model.GetTemplateURLs(); | 195 std::vector<const TemplateURL*> template_urls = model.GetTemplateURLs(); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 ((!import_to_bookmark_bar || !entry.in_toolbar) && | 351 ((!import_to_bookmark_bar || !entry.in_toolbar) && |
352 parent != model->other_node()))) { | 352 parent != model->other_node()))) { |
353 found_match = false; | 353 found_match = false; |
354 } | 354 } |
355 | 355 |
356 if (found_match) | 356 if (found_match) |
357 return true; // Found a match with the same url path and title. | 357 return true; // Found a match with the same url path and title. |
358 } | 358 } |
359 return false; | 359 return false; |
360 } | 360 } |
OLD | NEW |