OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/file_util.h" | 5 #include "base/file_util.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <propvarutil.h> | 8 #include <propvarutil.h> |
9 #include <psapi.h> | 9 #include <psapi.h> |
10 #include <shellapi.h> | 10 #include <shellapi.h> |
11 #include <shlobj.h> | 11 #include <shlobj.h> |
12 #include <time.h> | 12 #include <time.h> |
13 | 13 |
14 #include <limits> | 14 #include <limits> |
15 #include <string> | 15 #include <string> |
16 | 16 |
17 #include "base/file_path.h" | 17 #include "base/file_path.h" |
18 #include "base/logging.h" | 18 #include "base/logging.h" |
19 #include "base/metrics/histogram.h" | 19 #include "base/metrics/histogram.h" |
20 #include "base/win/pe_image.h" | |
21 #include "base/win/scoped_handle.h" | |
22 #include "base/string_number_conversions.h" | 20 #include "base/string_number_conversions.h" |
23 #include "base/string_util.h" | 21 #include "base/string_util.h" |
24 #include "base/threading/thread_restrictions.h" | 22 #include "base/threading/thread_restrictions.h" |
25 #include "base/time.h" | 23 #include "base/time.h" |
26 #include "base/utf_string_conversions.h" | 24 #include "base/utf_string_conversions.h" |
| 25 #include "base/win/pe_image.h" |
27 #include "base/win/scoped_comptr.h" | 26 #include "base/win/scoped_comptr.h" |
| 27 #include "base/win/scoped_handle.h" |
28 #include "base/win/win_util.h" | 28 #include "base/win/win_util.h" |
29 #include "base/win/windows_version.h" | 29 #include "base/win/windows_version.h" |
30 | 30 |
31 namespace file_util { | 31 namespace file_util { |
32 | 32 |
33 namespace { | 33 namespace { |
34 | 34 |
35 const DWORD kFileShareAll = | 35 const DWORD kFileShareAll = |
36 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; | 36 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; |
37 | 37 |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 base::ThreadRestrictions::AssertIOAllowed(); | 841 base::ThreadRestrictions::AssertIOAllowed(); |
842 BOOL ret = ::SetCurrentDirectory(directory.value().c_str()); | 842 BOOL ret = ::SetCurrentDirectory(directory.value().c_str()); |
843 return ret != 0; | 843 return ret != 0; |
844 } | 844 } |
845 | 845 |
846 /////////////////////////////////////////////// | 846 /////////////////////////////////////////////// |
847 // FileEnumerator | 847 // FileEnumerator |
848 | 848 |
849 FileEnumerator::FileEnumerator(const FilePath& root_path, | 849 FileEnumerator::FileEnumerator(const FilePath& root_path, |
850 bool recursive, | 850 bool recursive, |
851 FileEnumerator::FILE_TYPE file_type) | 851 FileType file_type) |
852 : recursive_(recursive), | 852 : recursive_(recursive), |
853 file_type_(file_type), | 853 file_type_(file_type), |
854 has_find_data_(false), | 854 has_find_data_(false), |
855 find_handle_(INVALID_HANDLE_VALUE) { | 855 find_handle_(INVALID_HANDLE_VALUE) { |
856 // INCLUDE_DOT_DOT must not be specified if recursive. | 856 // INCLUDE_DOT_DOT must not be specified if recursive. |
857 DCHECK(!(recursive && (INCLUDE_DOT_DOT & file_type_))); | 857 DCHECK(!(recursive && (INCLUDE_DOT_DOT & file_type_))); |
858 pending_paths_.push(root_path); | 858 pending_paths_.push(root_path); |
859 } | 859 } |
860 | 860 |
861 FileEnumerator::FileEnumerator(const FilePath& root_path, | 861 FileEnumerator::FileEnumerator(const FilePath& root_path, |
862 bool recursive, | 862 bool recursive, |
863 FileEnumerator::FILE_TYPE file_type, | 863 FileType file_type, |
864 const FilePath::StringType& pattern) | 864 const FilePath::StringType& pattern) |
865 : recursive_(recursive), | 865 : recursive_(recursive), |
866 file_type_(file_type), | 866 file_type_(file_type), |
867 has_find_data_(false), | 867 has_find_data_(false), |
868 pattern_(pattern), | 868 pattern_(pattern), |
869 find_handle_(INVALID_HANDLE_VALUE) { | 869 find_handle_(INVALID_HANDLE_VALUE) { |
870 // INCLUDE_DOT_DOT must not be specified if recursive. | 870 // INCLUDE_DOT_DOT must not be specified if recursive. |
871 DCHECK(!(recursive && (INCLUDE_DOT_DOT & file_type_))); | 871 DCHECK(!(recursive && (INCLUDE_DOT_DOT & file_type_))); |
872 pending_paths_.push(root_path); | 872 pending_paths_.push(root_path); |
873 } | 873 } |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1184 uint8 unused = *(touch + offset); | 1184 uint8 unused = *(touch + offset); |
1185 offset += step_size; | 1185 offset += step_size; |
1186 } | 1186 } |
1187 FreeLibrary(dll_module); | 1187 FreeLibrary(dll_module); |
1188 } | 1188 } |
1189 | 1189 |
1190 return true; | 1190 return true; |
1191 } | 1191 } |
1192 | 1192 |
1193 } // namespace file_util | 1193 } // namespace file_util |
OLD | NEW |