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

Side by Side Diff: chrome/browser/importer/ie_importer.cc

Issue 16392011: Move FileEnumerator to its own file, do some refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix incorrect includes Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
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 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 void IEImporter::ParseFavoritesFolder( 803 void IEImporter::ParseFavoritesFolder(
803 const FavoritesInfo& info, 804 const FavoritesInfo& info,
804 BookmarkVector* bookmarks, 805 BookmarkVector* bookmarks,
805 std::vector<ImportedFaviconUsage>* favicons) { 806 std::vector<ImportedFaviconUsage>* favicons) {
806 base::FilePath file; 807 base::FilePath file;
807 std::vector<base::FilePath::StringType> file_list; 808 std::vector<base::FilePath::StringType> file_list;
808 base::FilePath favorites_path(info.path); 809 base::FilePath favorites_path(info.path);
809 // Favorites path length. Make sure it doesn't include the trailing \. 810 // Favorites path length. Make sure it doesn't include the trailing \.
810 size_t favorites_path_len = 811 size_t favorites_path_len =
811 favorites_path.StripTrailingSeparators().value().size(); 812 favorites_path.StripTrailingSeparators().value().size();
812 file_util::FileEnumerator file_enumerator( 813 base::FileEnumerator file_enumerator(
813 favorites_path, true, file_util::FileEnumerator::FILES); 814 favorites_path, true, base::FileEnumerator::FILES);
814 while (!(file = file_enumerator.Next()).value().empty() && !cancelled()) 815 while (!(file = file_enumerator.Next()).value().empty() && !cancelled())
815 file_list.push_back(file.value()); 816 file_list.push_back(file.value());
816 817
817 // Keep the bookmarks in alphabetical order. 818 // Keep the bookmarks in alphabetical order.
818 std::sort(file_list.begin(), file_list.end()); 819 std::sort(file_list.begin(), file_list.end());
819 820
820 // Map from favicon URLs to the favicon data (the binary image data and the 821 // Map from favicon URLs to the favicon data (the binary image data and the
821 // set of bookmark URLs referring to the favicon). 822 // set of bookmark URLs referring to the favicon).
822 typedef std::map<GURL, ImportedFaviconUsage> FaviconMap; 823 typedef std::map<GURL, ImportedFaviconUsage> FaviconMap;
823 FaviconMap favicon_map; 824 FaviconMap favicon_map;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 static int version = -1; 886 static int version = -1;
886 if (version < 0) { 887 if (version < 0) {
887 wchar_t buffer[128]; 888 wchar_t buffer[128];
888 DWORD buffer_length = sizeof(buffer); 889 DWORD buffer_length = sizeof(buffer);
889 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ); 890 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ);
890 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL); 891 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL);
891 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0); 892 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0);
892 } 893 }
893 return version; 894 return version;
894 } 895 }
OLDNEW
« no previous file with comments | « chrome/browser/importer/firefox3_importer.cc ('k') | chrome/browser/media_galleries/fileapi/native_media_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698