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 |
| 14 #include <limits> |
13 #include <string> | 15 #include <string> |
14 | 16 |
15 #include "base/file_path.h" | 17 #include "base/file_path.h" |
16 #include "base/logging.h" | 18 #include "base/logging.h" |
17 #include "base/metrics/histogram.h" | 19 #include "base/metrics/histogram.h" |
18 #include "base/win/pe_image.h" | 20 #include "base/win/pe_image.h" |
19 #include "base/win/scoped_handle.h" | 21 #include "base/win/scoped_handle.h" |
20 #include "base/string_number_conversions.h" | 22 #include "base/string_number_conversions.h" |
21 #include "base/string_util.h" | 23 #include "base/string_util.h" |
22 #include "base/threading/thread_restrictions.h" | 24 #include "base/threading/thread_restrictions.h" |
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 | 888 |
887 bool FileEnumerator::IsDirectory(const FindInfo& info) { | 889 bool FileEnumerator::IsDirectory(const FindInfo& info) { |
888 return (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0; | 890 return (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0; |
889 } | 891 } |
890 | 892 |
891 // static | 893 // static |
892 FilePath FileEnumerator::GetFilename(const FindInfo& find_info) { | 894 FilePath FileEnumerator::GetFilename(const FindInfo& find_info) { |
893 return FilePath(find_info.cFileName); | 895 return FilePath(find_info.cFileName); |
894 } | 896 } |
895 | 897 |
| 898 // static |
| 899 int64 FileEnumerator::GetFilesize(const FindInfo& find_info) { |
| 900 ULARGE_INTEGER size; |
| 901 size.HighPart = find_info.nFileSizeHigh; |
| 902 size.LowPart = find_info.nFileSizeLow; |
| 903 DCHECK_LE(size.QuadPart, std::numeric_limits<int64>::max()); |
| 904 return static_cast<int64>(size.QuadPart); |
| 905 } |
| 906 |
| 907 // static |
| 908 base::Time FileEnumerator::GetLastModifiedTime(const FindInfo& find_info) { |
| 909 return base::Time::FromFileTime(find_info.ftLastWriteTime); |
| 910 } |
| 911 |
896 FilePath FileEnumerator::Next() { | 912 FilePath FileEnumerator::Next() { |
897 base::ThreadRestrictions::AssertIOAllowed(); | 913 base::ThreadRestrictions::AssertIOAllowed(); |
898 | 914 |
899 while (has_find_data_ || !pending_paths_.empty()) { | 915 while (has_find_data_ || !pending_paths_.empty()) { |
900 if (!has_find_data_) { | 916 if (!has_find_data_) { |
901 // The last find FindFirstFile operation is done, prepare a new one. | 917 // The last find FindFirstFile operation is done, prepare a new one. |
902 root_path_ = pending_paths_.top(); | 918 root_path_ = pending_paths_.top(); |
903 pending_paths_.pop(); | 919 pending_paths_.pop(); |
904 | 920 |
905 // Start a new find operation. | 921 // Start a new find operation. |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 uint8 unused = *(touch + offset); | 1184 uint8 unused = *(touch + offset); |
1169 offset += step_size; | 1185 offset += step_size; |
1170 } | 1186 } |
1171 FreeLibrary(dll_module); | 1187 FreeLibrary(dll_module); |
1172 } | 1188 } |
1173 | 1189 |
1174 return true; | 1190 return true; |
1175 } | 1191 } |
1176 | 1192 |
1177 } // namespace file_util | 1193 } // namespace file_util |
OLD | NEW |