Chromium Code Reviews| Index: chrome/utility/importer/bookmark_html_reader.cc |
| diff --git a/chrome/utility/importer/bookmark_html_reader.cc b/chrome/utility/importer/bookmark_html_reader.cc |
| index 8e524b83ee7e7f5953531805c254d847f6cab2e1..95f125c15a8e32e987aa9e093cbdff8c64163272 100644 |
| --- a/chrome/utility/importer/bookmark_html_reader.cc |
| +++ b/chrome/utility/importer/bookmark_html_reader.cc |
| @@ -121,6 +121,7 @@ void ImportBookmarksFile( |
| bool last_folder_on_toolbar = false; |
| bool last_folder_is_empty = true; |
| bool has_subfolder = false; |
| + bool has_last_folder = false; |
| base::Time last_folder_add_date; |
| std::vector<base::string16> path; |
| size_t toolbar_folder_index = 0; |
| @@ -153,6 +154,7 @@ void ImportBookmarksFile( |
| &last_folder, |
| &last_folder_on_toolbar, |
| &last_folder_add_date)) { |
| + has_last_folder = true; |
| continue; |
| } |
| @@ -207,7 +209,8 @@ void ImportBookmarksFile( |
| entry.path.assign(path.begin() + toolbar_folder_index - 1, path.end()); |
| } else { |
| // Add this bookmark to the list of |bookmarks|. |
| - if (!has_subfolder && !last_folder.empty()) { |
| + if (!has_subfolder && has_last_folder) { |
|
vitreb
2017/07/03 15:23:22
I used flag instead of checking for last_folder em
|
| + has_last_folder = false; |
|
Ilya Sherman
2017/07/05 18:00:31
nit: Please move this one or two lines down, to be
|
| path.push_back(last_folder); |
| last_folder.clear(); |
| } |
| @@ -226,7 +229,8 @@ void ImportBookmarksFile( |
| // Bookmarks in sub-folder are encapsulated with <DL> tag. |
| if (base::StartsWith(line, "<DL>", base::CompareCase::INSENSITIVE_ASCII)) { |
| has_subfolder = true; |
| - if (!last_folder.empty()) { |
| + if (has_last_folder) { |
| + has_last_folder = false; |
|
Ilya Sherman
2017/07/05 18:00:31
Ditto
|
| path.push_back(last_folder); |
| last_folder.clear(); |
| } |