OLD | NEW |
---|---|
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 bool has_subfolder = false; | 103 bool has_subfolder = false; |
104 base::Time last_folder_add_date; | 104 base::Time last_folder_add_date; |
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); |
Ilya Sherman
2013/08/09 01:26:18
nit: Please leave a blank line after this one.
zhchbin
2013/08/09 06:15:09
Done.
| |
114 // Remove "<HR>" if |line| starts with it. See http://crbug.com/257474. | |
115 if (StartsWithASCII(line, "<HR>", false)) | |
116 TrimString(line.substr(4), " ", &line); | |
Ilya Sherman
2013/08/09 01:26:18
Optional nit: I'd write this as follows, so that t
zhchbin
2013/08/09 06:15:09
Done.
| |
114 | 117 |
115 // Get the encoding of the bookmark file. | 118 // Get the encoding of the bookmark file. |
116 if (internal::ParseCharsetFromLine(line, &charset)) | 119 if (internal::ParseCharsetFromLine(line, &charset)) |
117 continue; | 120 continue; |
118 | 121 |
119 // Get the folder name. | 122 // Get the folder name. |
120 if (internal::ParseFolderNameFromLine(line, | 123 if (internal::ParseFolderNameFromLine(line, |
121 charset, | 124 charset, |
122 &last_folder, | 125 &last_folder, |
123 &last_folder_on_toolbar, | 126 &last_folder_on_toolbar, |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
423 *url = GURL(value); | 426 *url = GURL(value); |
424 } | 427 } |
425 } | 428 } |
426 | 429 |
427 return true; | 430 return true; |
428 } | 431 } |
429 | 432 |
430 } // namespace internal | 433 } // namespace internal |
431 | 434 |
432 } // namespace bookmark_html_reader | 435 } // namespace bookmark_html_reader |
OLD | NEW |