| 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/files/file_util.h" | 8 #include "base/files/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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 void ImportBookmarksFile( | 90 void ImportBookmarksFile( |
| 91 const base::Callback<bool(void)>& cancellation_callback, | 91 const base::Callback<bool(void)>& cancellation_callback, |
| 92 const base::Callback<bool(const GURL&)>& valid_url_callback, | 92 const base::Callback<bool(const GURL&)>& valid_url_callback, |
| 93 const base::FilePath& file_path, | 93 const base::FilePath& file_path, |
| 94 std::vector<ImportedBookmarkEntry>* bookmarks, | 94 std::vector<ImportedBookmarkEntry>* bookmarks, |
| 95 std::vector<importer::SearchEngineInfo>* search_engines, | 95 std::vector<importer::SearchEngineInfo>* search_engines, |
| 96 favicon_base::FaviconUsageDataList* favicons) { | 96 favicon_base::FaviconUsageDataList* favicons) { |
| 97 std::string content; | 97 std::string content; |
| 98 base::ReadFileToString(file_path, &content); | 98 base::ReadFileToString(file_path, &content); |
| 99 std::vector<std::string> lines; | 99 std::vector<std::string> lines = base::SplitString( |
| 100 base::SplitString(content, '\n', &lines); | 100 content, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 101 | 101 |
| 102 base::string16 last_folder; | 102 base::string16 last_folder; |
| 103 bool last_folder_on_toolbar = false; | 103 bool last_folder_on_toolbar = false; |
| 104 bool last_folder_is_empty = true; | 104 bool last_folder_is_empty = true; |
| 105 bool has_subfolder = false; | 105 bool has_subfolder = false; |
| 106 base::Time last_folder_add_date; | 106 base::Time last_folder_add_date; |
| 107 std::vector<base::string16> path; | 107 std::vector<base::string16> path; |
| 108 size_t toolbar_folder_index = 0; | 108 size_t toolbar_folder_index = 0; |
| 109 std::string charset = "UTF-8"; // If no charset is specified, assume utf-8. | 109 std::string charset = "UTF-8"; // If no charset is specified, assume utf-8. |
| 110 for (size_t i = 0; | 110 for (size_t i = 0; |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 *url = GURL(value); | 471 *url = GURL(value); |
| 472 } | 472 } |
| 473 } | 473 } |
| 474 | 474 |
| 475 return true; | 475 return true; |
| 476 } | 476 } |
| 477 | 477 |
| 478 } // namespace internal | 478 } // namespace internal |
| 479 | 479 |
| 480 } // namespace bookmark_html_reader | 480 } // namespace bookmark_html_reader |
| OLD | NEW |