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

Side by Side 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: Revise test cases. 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 unified diff | Download patch
OLDNEW
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/bookmark_html_reader.h" 5 #include "chrome/utility/importer/bookmark_html_reader.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/i18n/icu_string_conversions.h" 9 #include "base/i18n/icu_string_conversions.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 std::vector<base::string16> path; 105 std::vector<base::string16> path;
106 size_t toolbar_folder_index = 0; 106 size_t toolbar_folder_index = 0;
107 std::string charset; 107 std::string charset;
108 for (size_t i = 0; 108 for (size_t i = 0;
109 i < lines.size() && 109 i < lines.size() &&
110 (cancellation_callback.is_null() || !cancellation_callback.Run()); 110 (cancellation_callback.is_null() || !cancellation_callback.Run());
111 ++i) { 111 ++i) {
112 std::string line; 112 std::string line;
113 TrimString(lines[i], " ", &line); 113 TrimString(lines[i], " ", &line);
114 114
115 // Remove "<HR>" if |line| starts with it. See http://crbug.com/257474.
116 static const char kHrTag[] = "<HR>";
117 while (StartsWithASCII(line, kHrTag, false)) {
zhchbin 2013/08/10 06:06:02 Note this, I have change it from "if" to "while".
tfarina 2013/08/10 14:30:51 Could also note in the comments that we are removi
zhchbin 2013/08/10 14:45:39 Done.
118 line.erase(0, arraysize(kHrTag) - 1);
119 TrimString(line, " ", &line);
120 }
121
115 // Get the encoding of the bookmark file. 122 // Get the encoding of the bookmark file.
116 if (internal::ParseCharsetFromLine(line, &charset)) 123 if (internal::ParseCharsetFromLine(line, &charset))
117 continue; 124 continue;
118 125
119 // Get the folder name. 126 // Get the folder name.
120 if (internal::ParseFolderNameFromLine(line, 127 if (internal::ParseFolderNameFromLine(line,
121 charset, 128 charset,
122 &last_folder, 129 &last_folder,
123 &last_folder_on_toolbar, 130 &last_folder_on_toolbar,
124 &last_folder_add_date)) { 131 &last_folder_add_date)) {
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 *url = GURL(value); 430 *url = GURL(value);
424 } 431 }
425 } 432 }
426 433
427 return true; 434 return true;
428 } 435 }
429 436
430 } // namespace internal 437 } // namespace internal
431 438
432 } // namespace bookmark_html_reader 439 } // namespace bookmark_html_reader
OLDNEW
« no previous file with comments | « chrome/test/data/bookmark_html_reader/firefox23.html ('k') | chrome/utility/importer/bookmark_html_reader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698