OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/edge_importer_win.h" | 5 #include "chrome/utility/importer/edge_importer_win.h" |
6 | 6 |
7 #include <Shlobj.h> | 7 #include <Shlobj.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
| 11 #include <memory> |
11 #include <string> | 12 #include <string> |
12 #include <tuple> | 13 #include <tuple> |
13 #include <vector> | 14 #include <vector> |
14 | 15 |
15 #include "base/files/file_enumerator.h" | 16 #include "base/files/file_enumerator.h" |
16 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" |
17 #include "base/files/file_util.h" | 18 #include "base/files/file_util.h" |
18 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
19 #include "base/memory/scoped_ptr.h" | |
20 #include "base/strings/string16.h" | 20 #include "base/strings/string16.h" |
21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
22 #include "base/time/time.h" | 22 #include "base/time/time.h" |
23 #include "base/win/windows_version.h" | 23 #include "base/win/windows_version.h" |
24 #include "chrome/common/importer/edge_importer_utils_win.h" | 24 #include "chrome/common/importer/edge_importer_utils_win.h" |
25 #include "chrome/common/importer/imported_bookmark_entry.h" | 25 #include "chrome/common/importer/imported_bookmark_entry.h" |
26 #include "chrome/common/importer/importer_bridge.h" | 26 #include "chrome/common/importer/importer_bridge.h" |
27 #include "chrome/grit/generated_resources.h" | 27 #include "chrome/grit/generated_resources.h" |
28 #include "chrome/utility/importer/edge_database_reader_win.h" | 28 #include "chrome/utility/importer/edge_database_reader_win.h" |
29 #include "chrome/utility/importer/favicon_reencode.h" | 29 #include "chrome/utility/importer/favicon_reencode.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 base::FilePath database_path = FindSpartanDatabase(source_path_); | 208 base::FilePath database_path = FindSpartanDatabase(source_path_); |
209 if (database_path.empty()) | 209 if (database_path.empty()) |
210 return; | 210 return; |
211 | 211 |
212 EdgeDatabaseReader database; | 212 EdgeDatabaseReader database; |
213 if (!database.OpenDatabase(database_path.value())) { | 213 if (!database.OpenDatabase(database_path.value())) { |
214 DVLOG(1) << "Error opening database " << database.GetErrorMessage(); | 214 DVLOG(1) << "Error opening database " << database.GetErrorMessage(); |
215 return; | 215 return; |
216 } | 216 } |
217 | 217 |
218 scoped_ptr<EdgeDatabaseTableEnumerator> enumerator = | 218 std::unique_ptr<EdgeDatabaseTableEnumerator> enumerator = |
219 database.OpenTableEnumerator(L"Favorites"); | 219 database.OpenTableEnumerator(L"Favorites"); |
220 if (!enumerator) { | 220 if (!enumerator) { |
221 DVLOG(1) << "Error opening database table " << database.GetErrorMessage(); | 221 DVLOG(1) << "Error opening database table " << database.GetErrorMessage(); |
222 return; | 222 return; |
223 } | 223 } |
224 | 224 |
225 if (!enumerator->Reset()) | 225 if (!enumerator->Reset()) |
226 return; | 226 return; |
227 | 227 |
228 std::map<GUID, EdgeFavoriteEntry, GuidComparator> database_entries; | 228 std::map<GUID, EdgeFavoriteEntry, GuidComparator> database_entries; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 // With tree built sort the children of each node including the root. | 279 // With tree built sort the children of each node including the root. |
280 std::sort(root_entry.children.begin(), root_entry.children.end(), | 280 std::sort(root_entry.children.begin(), root_entry.children.end(), |
281 EdgeFavoriteEntryComparator()); | 281 EdgeFavoriteEntryComparator()); |
282 for (auto& entry : database_entries) { | 282 for (auto& entry : database_entries) { |
283 std::sort(entry.second.children.begin(), entry.second.children.end(), | 283 std::sort(entry.second.children.begin(), entry.second.children.end(), |
284 EdgeFavoriteEntryComparator()); | 284 EdgeFavoriteEntryComparator()); |
285 } | 285 } |
286 std::vector<base::string16> path; | 286 std::vector<base::string16> path; |
287 BuildBookmarkEntries(root_entry, false, bookmarks, favicons, &path); | 287 BuildBookmarkEntries(root_entry, false, bookmarks, favicons, &path); |
288 } | 288 } |
OLD | NEW |