| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/utility/importer/bookmarks_file_importer.h" | 5 #include "chrome/utility/importer/bookmarks_file_importer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "chrome/common/importer/imported_bookmark_entry.h" | 8 #include "chrome/common/importer/imported_bookmark_entry.h" |
| 9 #include "chrome/common/importer/imported_favicon_usage.h" | 9 #include "chrome/common/importer/imported_favicon_usage.h" |
| 10 #include "chrome/common/importer/importer_bridge.h" | 10 #include "chrome/common/importer/importer_bridge.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 uint16 items, | 83 uint16 items, |
| 84 ImporterBridge* bridge) { | 84 ImporterBridge* bridge) { |
| 85 // The only thing this importer can import is a bookmarks file, aka | 85 // The only thing this importer can import is a bookmarks file, aka |
| 86 // "favorites". | 86 // "favorites". |
| 87 DCHECK_EQ(importer::FAVORITES, items); | 87 DCHECK_EQ(importer::FAVORITES, items); |
| 88 | 88 |
| 89 bridge->NotifyStarted(); | 89 bridge->NotifyStarted(); |
| 90 bridge->NotifyItemStarted(importer::FAVORITES); | 90 bridge->NotifyItemStarted(importer::FAVORITES); |
| 91 | 91 |
| 92 std::vector<ImportedBookmarkEntry> bookmarks; | 92 std::vector<ImportedBookmarkEntry> bookmarks; |
| 93 std::vector<importer::SearchEngineInfo> search_engines; |
| 93 std::vector<ImportedFaviconUsage> favicons; | 94 std::vector<ImportedFaviconUsage> favicons; |
| 94 | 95 |
| 95 bookmark_html_reader::ImportBookmarksFile( | 96 bookmark_html_reader::ImportBookmarksFile( |
| 96 base::Bind(IsImporterCancelled, base::Unretained(this)), | 97 base::Bind(IsImporterCancelled, base::Unretained(this)), |
| 97 base::Bind(internal::CanImportURL), | 98 base::Bind(internal::CanImportURL), |
| 98 source_profile.source_path, | 99 source_profile.source_path, |
| 99 &bookmarks, | 100 &bookmarks, |
| 101 &search_engines, |
| 100 &favicons); | 102 &favicons); |
| 101 | 103 |
| 102 if (!bookmarks.empty() && !cancelled()) { | 104 if (!bookmarks.empty() && !cancelled()) { |
| 103 base::string16 first_folder_name = | 105 base::string16 first_folder_name = |
| 104 bridge->GetLocalizedString(IDS_BOOKMARK_GROUP); | 106 bridge->GetLocalizedString(IDS_BOOKMARK_GROUP); |
| 105 bridge->AddBookmarks(bookmarks, first_folder_name); | 107 bridge->AddBookmarks(bookmarks, first_folder_name); |
| 106 } | 108 } |
| 109 if (!search_engines.empty()) |
| 110 bridge->SetKeywords(search_engines, false); |
| 107 if (!favicons.empty()) | 111 if (!favicons.empty()) |
| 108 bridge->SetFavicons(favicons); | 112 bridge->SetFavicons(favicons); |
| 109 | 113 |
| 110 bridge->NotifyItemEnded(importer::FAVORITES); | 114 bridge->NotifyItemEnded(importer::FAVORITES); |
| 111 bridge->NotifyEnded(); | 115 bridge->NotifyEnded(); |
| 112 } | 116 } |
| OLD | NEW |