Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3218)

Unified Diff: chrome/browser/importer/firefox3_importer.cc

Issue 6979007: Many fixes to bookmark importing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Happy tests =) Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/importer/firefox2_importer.cc ('k') | chrome/browser/importer/firefox_importer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/importer/firefox3_importer.cc
diff --git a/chrome/browser/importer/firefox3_importer.cc b/chrome/browser/importer/firefox3_importer.cc
index 606549facdf78b8ccd8355c30599820043eb6711..0411dc72c4c85fb568d0feb033975c23c315c65c 100644
--- a/chrome/browser/importer/firefox3_importer.cc
+++ b/chrome/browser/importer/firefox3_importer.cc
@@ -208,8 +208,8 @@ void Firefox3Importer::ImportBookmarks() {
BookmarkItem* item = list[i];
if (item->type == TYPE_FOLDER) {
- // Folders are added implicitly on adding children,
- // so now we pass only empty folders to add them explicitly.
+ // Folders are added implicitly on adding children, so we only explicitly
+ // add empty folders.
if (!item->empty_folder)
continue;
} else if (item->type == TYPE_BOOKMARK) {
@@ -232,31 +232,28 @@ void Firefox3Importer::ImportBookmarks() {
bool is_in_toolbar = false;
while (child->parent >= 0) {
BookmarkItem* parent = list[child->parent];
- if (parent->id == toolbar_folder_id) {
- // This bookmark entry should be put in the bookmark bar.
- // But we put it in the Firefox group after first run, so
- // that do not mess up the bookmark bar.
- if (import_to_bookmark_bar()) {
- is_in_toolbar = true;
- } else {
- path.insert(path.begin(), parent->title);
- path.insert(path.begin(), firefox_folder);
- }
- found_path = true;
+ if (livemark_id.find(parent->id) != livemark_id.end()) {
+ // Don't import live bookmarks.
break;
- } else if (parent->id == menu_folder_id ||
- parent->id == unsorted_folder_id) {
- // After the first run, the item will be placed in a folder in
- // the "Other bookmarks".
- if (!import_to_bookmark_bar())
- path.insert(path.begin(), firefox_folder);
+ }
+
+ if (parent->id != menu_folder_id) {
+ // To avoid excessive nesting, omit the name for the bookmarks menu
+ // folder.
+ path.insert(path.begin(), parent->title);
+ }
+
+ if (parent->id == toolbar_folder_id)
+ is_in_toolbar = true;
+
+ if (parent->id == toolbar_folder_id ||
+ parent->id == menu_folder_id ||
+ parent->id == unsorted_folder_id) {
+ // We've reached a root node, hooray!
found_path = true;
break;
- } else if (livemark_id.find(parent->id) != livemark_id.end()) {
- // If the entry is under a livemark folder, we don't import it.
- break;
}
- path.insert(path.begin(), parent->title);
+
child = parent;
}
@@ -291,10 +288,7 @@ void Firefox3Importer::ImportBookmarks() {
if (!bookmarks.empty() && !cancelled()) {
const string16& first_folder_name =
bridge_->GetLocalizedString(IDS_BOOKMARK_GROUP_FROM_FIREFOX);
- int options = 0;
- if (import_to_bookmark_bar())
- options = ProfileWriter::IMPORT_TO_BOOKMARK_BAR;
- bridge_->AddBookmarks(bookmarks, first_folder_name, options);
+ bridge_->AddBookmarks(bookmarks, first_folder_name);
}
if (!template_urls.empty() && !cancelled()) {
bridge_->SetKeywords(template_urls, -1, false);
« no previous file with comments | « chrome/browser/importer/firefox2_importer.cc ('k') | chrome/browser/importer/firefox_importer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698