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

Unified Diff: chrome/utility/importer/bookmark_html_reader.cc

Issue 22408007: Remove "<HR>" tags to import Firefox bookmarks correctly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits fix and add a test case. Created 7 years, 4 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
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 5d34d7b191a817ce63ad6cf27df6cf68d6a56ce1..f2bfef139cced7bc2099e068cbdda9df893982e3 100644
--- a/chrome/utility/importer/bookmark_html_reader.cc
+++ b/chrome/utility/importer/bookmark_html_reader.cc
@@ -92,6 +92,7 @@ void ImportBookmarksFile(
const base::FilePath& file_path,
std::vector<ImportedBookmarkEntry>* bookmarks,
std::vector<ImportedFaviconUsage>* favicons) {
+ const std::string kHrTag = "<HR>";
gab 2013/08/09 13:27:30 All string constants should be of the form: stat
std::string content;
file_util::ReadFileToString(file_path, &content);
std::vector<std::string> lines;
@@ -112,6 +113,10 @@ void ImportBookmarksFile(
std::string line;
TrimString(lines[i], " ", &line);
+ // Remove "<HR>" if |line| starts with it. See http://crbug.com/257474.
+ if (StartsWithASCII(line, kHrTag, false))
+ TrimString(line.substr(kHrTag.size()), " ", &line);
gab 2013/08/09 13:27:30 use "arraysize(kHrTag)" here instead of kHrTag.siz
gab 2013/08/09 13:27:30 This line is slightly tricky and it creates a new
zhchbin 2013/08/09 14:20:00 Can you accept line.erase(0, arraysize(kHrTag) -
gab 2013/08/09 14:29:03 Ah, right, yes, because the actual arraysize inclu
+
// Get the encoding of the bookmark file.
if (internal::ParseCharsetFromLine(line, &charset))
continue;

Powered by Google App Engine
This is Rietveld 408576698