Index: chrome/utility/importer/ie_importer_win.cc |
diff --git a/chrome/utility/importer/ie_importer_win.cc b/chrome/utility/importer/ie_importer_win.cc |
index bc017acffa81f63a30f63caebbb2ab4291a5b0eb..9fe9392097cecf08219122d0ddde15f8fd70caf5 100644 |
--- a/chrome/utility/importer/ie_importer_win.cc |
+++ b/chrome/utility/importer/ie_importer_win.cc |
@@ -29,6 +29,7 @@ |
#include "base/win/scoped_handle.h" |
#include "base/win/scoped_propvariant.h" |
#include "base/win/windows_version.h" |
+#include "chrome/common/importer/edge_importer_utils_win.h" |
#include "chrome/common/importer/ie_importer_utils_win.h" |
#include "chrome/common/importer/imported_bookmark_entry.h" |
#include "chrome/common/importer/importer_bridge.h" |
@@ -420,14 +421,23 @@ const GUID IEImporter::kUnittestGUID = { |
{ 0xb8, 0x7, 0x3d, 0x46, 0xab, 0x15, 0x45, 0xdf } |
}; |
-IEImporter::IEImporter() { |
-} |
+IEImporter::IEImporter() : edge_import_mode_(false) {} |
void IEImporter::StartImport(const importer::SourceProfile& source_profile, |
uint16 items, |
ImporterBridge* bridge) { |
+ edge_import_mode_ = source_profile.importer_type == importer::TYPE_EDGE; |
bridge_ = bridge; |
- source_path_ = source_profile.source_path; |
+ |
+ if (edge_import_mode_) { |
+ // When using for Edge imports we only support Favorites. |
+ DCHECK(items == importer::FAVORITES); |
Ilya Sherman
2015/11/26 02:04:45
nit: DCHECK_EQ
forshaw
2015/11/30 12:57:59
Acknowledged.
|
+ // As coming from untrusted source ensure items is correct. |
+ items = importer::FAVORITES; |
+ source_path_ = importer::GetEdgeDataFilePath(); |
Ilya Sherman
2015/11/26 02:04:45
Why isn't this just set on the SourceProfiler?
forshaw
2015/11/30 12:57:59
Moved this to being initialized in importer_list.
|
+ } |
+ if (!source_profile.source_path.empty()) |
+ source_path_ = source_profile.source_path; |
bridge_->NotifyStarted(); |
@@ -478,7 +488,10 @@ void IEImporter::ImportFavorites() { |
if (!bookmarks.empty() && !cancelled()) { |
const base::string16& first_folder_name = |
- l10n_util::GetStringUTF16(IDS_BOOKMARK_GROUP_FROM_IE); |
+ edge_import_mode_ |
+ ? l10n_util::GetStringUTF16(IDS_BOOKMARK_GROUP_FROM_EDGE) |
+ : l10n_util::GetStringUTF16(IDS_BOOKMARK_GROUP_FROM_IE); |
+ |
bridge_->AddBookmarks(bookmarks, first_folder_name); |
} |
if (!favicons.empty() && !cancelled()) |
@@ -782,7 +795,7 @@ void IEImporter::ImportHomepage() { |
bool IEImporter::GetFavoritesInfo(IEImporter::FavoritesInfo* info) { |
if (!source_path_.empty()) { |
- // Source path exists during testing. |
+ // Source path exists during testing as well as importing from Edge. |
Ilya Sherman
2015/11/26 02:04:45
nit: "as well as importing" -> "as well as when im
forshaw
2015/11/30 12:57:59
Acknowledged.
|
info->path = source_path_; |
info->path = info->path.AppendASCII("Favorites"); |
info->links_folder = L"Links"; |
@@ -888,8 +901,10 @@ void IEImporter::ParseFavoritesFolder( |
bookmarks->push_back(entry); |
} |
- // Reflect the menu order in IE. |
- SortBookmarksInIEOrder(this, bookmarks); |
+ if (!edge_import_mode_) { |
+ // Reflect the menu order in IE. |
+ SortBookmarksInIEOrder(this, bookmarks); |
+ } |
// Record favicon data. |
for (FaviconMap::iterator iter = favicon_map.begin(); |