Chromium Code Reviews| Index: chrome/utility/importer/firefox_importer.cc |
| diff --git a/chrome/utility/importer/firefox_importer.cc b/chrome/utility/importer/firefox_importer.cc |
| index 6444e29bdfb56afd07e74d0355f568520ab095b5..de045d6b134b2598f94eac597d65234b9fb19d36 100644 |
| --- a/chrome/utility/importer/firefox_importer.cc |
| +++ b/chrome/utility/importer/firefox_importer.cc |
| @@ -51,10 +51,12 @@ void LoadDefaultBookmarks(const base::FilePath& app_path, |
| urls->clear(); |
| std::vector<ImportedBookmarkEntry> bookmarks; |
| + std::vector<importer::URLKeywordInfo> url_keywords; |
| bookmark_html_reader::ImportBookmarksFile(base::Callback<bool(void)>(), |
| base::Callback<bool(const GURL&)>(), |
| file, |
| &bookmarks, |
| + &url_keywords, |
| NULL); |
| for (size_t i = 0; i < bookmarks.size(); ++i) |
| urls->insert(bookmarks[i].url); |
| @@ -252,9 +254,24 @@ void FirefoxImporter::ImportBookmarks() { |
| if (!item->empty_folder) |
| continue; |
| } else if (item->type == TYPE_BOOKMARK) { |
| - // Import only valid bookmarks |
| - if (!CanImportURL(item->url)) |
| + // Import only valid bookmarks. |
| + if (!CanImportURL(item->url)) { |
| + base::string16 decoded_url; |
| + // Import invalid bookmark's keyword as search engine. |
|
Peter Kasting
2014/10/01 01:02:55
How is the functionality from this file different
Tapu Ghose
2014/10/07 02:02:45
I agree.
|
| + if (!item->keyword.empty() && |
| + bookmark_html_reader::CanImportURLAsSearchEngine(item->url, |
| + &decoded_url)) { |
| + importer::URLKeywordInfo url_keyword_info; |
| + // Since |item->url| is invalid, set raw_url property of |
| + // |url_keyword_info| which will be used in importing as search |
| + // engine. |
| + url_keyword_info.raw_url = decoded_url; |
| + url_keyword_info.keyword.assign(base::UTF8ToUTF16(item->keyword)); |
| + url_keyword_info.display_name = item->title; |
| + url_keywords.push_back(url_keyword_info); |
| + } |
|
Ilya Sherman
2014/09/30 20:54:13
Please add test coverage for these changes
Tapu Ghose
2014/10/07 02:02:45
Added a new bookmark entry into places.sql files p
Ilya Sherman
2014/10/07 22:08:22
Let's get this CL fully sorted out, with all tests
Tapu Ghose
2014/10/12 00:58:19
Tests passing for me locally.
|
| continue; |
| + } |
| } else { |
| continue; |
| } |