OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/importer/ie_importer.h" | 5 #include "chrome/browser/importer/ie_importer.h" |
6 | 6 |
7 #include <ole2.h> | 7 #include <ole2.h> |
8 #include <intshcut.h> | 8 #include <intshcut.h> |
9 #include <shlobj.h> | 9 #include <shlobj.h> |
10 #include <urlhist.h> | 10 #include <urlhist.h> |
11 #include <wininet.h> | 11 #include <wininet.h> |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 #include <map> | 14 #include <map> |
15 #include <string> | 15 #include <string> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
18 #include "base/file_util.h" | 18 #include "base/file_util.h" |
| 19 #include "base/files/file_enumerator.h" |
19 #include "base/files/file_path.h" | 20 #include "base/files/file_path.h" |
20 #include "base/string16.h" | 21 #include "base/string16.h" |
21 #include "base/string_util.h" | 22 #include "base/string_util.h" |
22 #include "base/strings/string_split.h" | 23 #include "base/strings/string_split.h" |
23 #include "base/time.h" | 24 #include "base/time.h" |
24 #include "base/utf_string_conversions.h" | 25 #include "base/utf_string_conversions.h" |
25 #include "base/win/registry.h" | 26 #include "base/win/registry.h" |
26 #include "base/win/scoped_co_mem.h" | 27 #include "base/win/scoped_co_mem.h" |
27 #include "base/win/scoped_comptr.h" | 28 #include "base/win/scoped_comptr.h" |
28 #include "base/win/scoped_handle.h" | 29 #include "base/win/scoped_handle.h" |
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 void IEImporter::ParseFavoritesFolder( | 810 void IEImporter::ParseFavoritesFolder( |
810 const FavoritesInfo& info, | 811 const FavoritesInfo& info, |
811 BookmarkVector* bookmarks, | 812 BookmarkVector* bookmarks, |
812 std::vector<history::ImportedFaviconUsage>* favicons) { | 813 std::vector<history::ImportedFaviconUsage>* favicons) { |
813 base::FilePath file; | 814 base::FilePath file; |
814 std::vector<base::FilePath::StringType> file_list; | 815 std::vector<base::FilePath::StringType> file_list; |
815 base::FilePath favorites_path(info.path); | 816 base::FilePath favorites_path(info.path); |
816 // Favorites path length. Make sure it doesn't include the trailing \. | 817 // Favorites path length. Make sure it doesn't include the trailing \. |
817 size_t favorites_path_len = | 818 size_t favorites_path_len = |
818 favorites_path.StripTrailingSeparators().value().size(); | 819 favorites_path.StripTrailingSeparators().value().size(); |
819 file_util::FileEnumerator file_enumerator( | 820 base::FileEnumerator file_enumerator( |
820 favorites_path, true, file_util::FileEnumerator::FILES); | 821 favorites_path, true, base::FileEnumerator::FILES); |
821 while (!(file = file_enumerator.Next()).value().empty() && !cancelled()) | 822 while (!(file = file_enumerator.Next()).value().empty() && !cancelled()) |
822 file_list.push_back(file.value()); | 823 file_list.push_back(file.value()); |
823 | 824 |
824 // Keep the bookmarks in alphabetical order. | 825 // Keep the bookmarks in alphabetical order. |
825 std::sort(file_list.begin(), file_list.end()); | 826 std::sort(file_list.begin(), file_list.end()); |
826 | 827 |
827 // Map from favicon URLs to the favicon data (the binary image data and the | 828 // Map from favicon URLs to the favicon data (the binary image data and the |
828 // set of bookmark URLs referring to the favicon). | 829 // set of bookmark URLs referring to the favicon). |
829 typedef std::map<GURL, history::ImportedFaviconUsage> FaviconMap; | 830 typedef std::map<GURL, history::ImportedFaviconUsage> FaviconMap; |
830 FaviconMap favicon_map; | 831 FaviconMap favicon_map; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 static int version = -1; | 893 static int version = -1; |
893 if (version < 0) { | 894 if (version < 0) { |
894 wchar_t buffer[128]; | 895 wchar_t buffer[128]; |
895 DWORD buffer_length = sizeof(buffer); | 896 DWORD buffer_length = sizeof(buffer); |
896 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ); | 897 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ); |
897 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL); | 898 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL); |
898 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0); | 899 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0); |
899 } | 900 } |
900 return version; | 901 return version; |
901 } | 902 } |
OLD | NEW |