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

Side by Side Diff: base/file_util_win.cc

Issue 7355013: Adding size and last modified time support to FileEnumerator and FileUtilProxy::Entry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 years, 5 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
« no previous file with comments | « base/file_util_proxy.cc ('k') | webkit/fileapi/file_system_directory_database.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <limits>
brettw 2011/07/13 15:51:41 Can you add a blank line here between the C & C++
tzik 2011/07/14 07:05:42 Done.
13 #include <string> 14 #include <string>
14 15
15 #include "base/file_path.h" 16 #include "base/file_path.h"
16 #include "base/logging.h" 17 #include "base/logging.h"
17 #include "base/metrics/histogram.h" 18 #include "base/metrics/histogram.h"
18 #include "base/win/pe_image.h" 19 #include "base/win/pe_image.h"
19 #include "base/win/scoped_handle.h" 20 #include "base/win/scoped_handle.h"
20 #include "base/string_number_conversions.h" 21 #include "base/string_number_conversions.h"
21 #include "base/string_util.h" 22 #include "base/string_util.h"
22 #include "base/threading/thread_restrictions.h" 23 #include "base/threading/thread_restrictions.h"
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 887
887 bool FileEnumerator::IsDirectory(const FindInfo& info) { 888 bool FileEnumerator::IsDirectory(const FindInfo& info) {
888 return (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0; 889 return (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
889 } 890 }
890 891
891 // static 892 // static
892 FilePath FileEnumerator::GetFilename(const FindInfo& find_info) { 893 FilePath FileEnumerator::GetFilename(const FindInfo& find_info) {
893 return FilePath(find_info.cFileName); 894 return FilePath(find_info.cFileName);
894 } 895 }
895 896
897 // static
898 int64 FileEnumerator::GetFilesize(const FindInfo& find_info) {
899 ULARGE_INTEGER size;
900 size.HighPart = find_info.nFileSizeHigh;
901 size.LowPart = find_info.nFileSizeLow;
902 DCHECK(size.QuadPart <= std::numeric_limits<int64>::max());
brettw 2011/07/13 15:51:41 I probably wouldn't bother with this check, it's n
tzik 2011/07/14 07:05:42 Out of my cowardice, QuadPart can be greater than
kinuko 2011/07/14 07:18:17 Long live chromium... style-nit: it'd be better t
tzik 2011/07/14 10:42:45 Done.
903 return static_cast<int64>(size.QuadPart);
904 }
905
906 // static
907 base::Time FileEnumerator::GetLastModifiedTime(const FindInfo& find_info) {
908 return base::Time::FromFileTime(find_info.ftLastWriteTime);
909 }
910
896 FilePath FileEnumerator::Next() { 911 FilePath FileEnumerator::Next() {
897 base::ThreadRestrictions::AssertIOAllowed(); 912 base::ThreadRestrictions::AssertIOAllowed();
898 913
899 while (has_find_data_ || !pending_paths_.empty()) { 914 while (has_find_data_ || !pending_paths_.empty()) {
900 if (!has_find_data_) { 915 if (!has_find_data_) {
901 // The last find FindFirstFile operation is done, prepare a new one. 916 // The last find FindFirstFile operation is done, prepare a new one.
902 root_path_ = pending_paths_.top(); 917 root_path_ = pending_paths_.top();
903 pending_paths_.pop(); 918 pending_paths_.pop();
904 919
905 // Start a new find operation. 920 // Start a new find operation.
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 uint8 unused = *(touch + offset); 1183 uint8 unused = *(touch + offset);
1169 offset += step_size; 1184 offset += step_size;
1170 } 1185 }
1171 FreeLibrary(dll_module); 1186 FreeLibrary(dll_module);
1172 } 1187 }
1173 1188
1174 return true; 1189 return true;
1175 } 1190 }
1176 1191
1177 } // namespace file_util 1192 } // namespace file_util
OLDNEW
« no previous file with comments | « base/file_util_proxy.cc ('k') | webkit/fileapi/file_system_directory_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698