Index: net/base/directory_lister.cc |
diff --git a/net/base/directory_lister.cc b/net/base/directory_lister.cc |
index c01289e546892f52e77356e8bde80498e3640ad9..2f7e473d17b9c344864bd3378d56fbea2e6546ee 100644 |
--- a/net/base/directory_lister.cc |
+++ b/net/base/directory_lister.cc |
@@ -9,6 +9,7 @@ |
#include "base/bind.h" |
#include "base/file_util.h" |
+#include "base/files/file_enumerator.h" |
#include "base/i18n/file_util_icu.h" |
#include "base/message_loop.h" |
#include "base/threading/thread_restrictions.h" |
@@ -31,47 +32,35 @@ bool IsDotDot(const base::FilePath& path) { |
bool CompareAlphaDirsFirst(const DirectoryLister::DirectoryListerData& a, |
const DirectoryLister::DirectoryListerData& b) { |
// Parent directory before all else. |
- if (IsDotDot(file_util::FileEnumerator::GetFilename(a.info))) |
+ if (IsDotDot(a.info.GetName())) |
return true; |
- if (IsDotDot(file_util::FileEnumerator::GetFilename(b.info))) |
+ if (IsDotDot(b.info.GetName())) |
return false; |
// Directories before regular files. |
- bool a_is_directory = file_util::FileEnumerator::IsDirectory(a.info); |
- bool b_is_directory = file_util::FileEnumerator::IsDirectory(b.info); |
+ bool a_is_directory = a.info.IsDirectory(); |
+ bool b_is_directory = b.info.IsDirectory(); |
if (a_is_directory != b_is_directory) |
return a_is_directory; |
- return file_util::LocaleAwareCompareFilenames( |
- file_util::FileEnumerator::GetFilename(a.info), |
- file_util::FileEnumerator::GetFilename(b.info)); |
+ return file_util::LocaleAwareCompareFilenames(a.info.GetName(), |
+ b.info.GetName()); |
} |
bool CompareDate(const DirectoryLister::DirectoryListerData& a, |
const DirectoryLister::DirectoryListerData& b) { |
// Parent directory before all else. |
- if (IsDotDot(file_util::FileEnumerator::GetFilename(a.info))) |
+ if (IsDotDot(a.info.GetName())) |
return true; |
- if (IsDotDot(file_util::FileEnumerator::GetFilename(b.info))) |
+ if (IsDotDot(b.info.GetName())) |
return false; |
// Directories before regular files. |
- bool a_is_directory = file_util::FileEnumerator::IsDirectory(a.info); |
- bool b_is_directory = file_util::FileEnumerator::IsDirectory(b.info); |
+ bool a_is_directory = a.info.IsDirectory(); |
+ bool b_is_directory = b.info.IsDirectory(); |
if (a_is_directory != b_is_directory) |
return a_is_directory; |
-#if defined(OS_POSIX) |
- return a.info.stat.st_mtime > b.info.stat.st_mtime; |
-#elif defined(OS_WIN) |
- if (a.info.ftLastWriteTime.dwHighDateTime == |
- b.info.ftLastWriteTime.dwHighDateTime) { |
- return a.info.ftLastWriteTime.dwLowDateTime > |
- b.info.ftLastWriteTime.dwLowDateTime; |
- } else { |
- return a.info.ftLastWriteTime.dwHighDateTime > |
- b.info.ftLastWriteTime.dwHighDateTime; |
- } |
-#endif |
+ return a.info.GetLastModifiedTime() > b.info.GetLastModifiedTime(); |
} |
// Comparator for sorting find result by paths. This uses the locale-aware |
@@ -161,18 +150,17 @@ void DirectoryLister::Core::StartInternal() { |
return; |
} |
- int types = file_util::FileEnumerator::FILES | |
- file_util::FileEnumerator::DIRECTORIES; |
+ int types = base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES; |
if (!recursive_) |
- types |= file_util::FileEnumerator::INCLUDE_DOT_DOT; |
+ types |= base::FileEnumerator::INCLUDE_DOT_DOT; |
- file_util::FileEnumerator file_enum(dir_, recursive_, types); |
+ base::FileEnumerator file_enum(dir_, recursive_, types); |
base::FilePath path; |
std::vector<DirectoryListerData> file_data; |
while (lister_ && !(path = file_enum.Next()).empty()) { |
DirectoryListerData data; |
- file_enum.GetFindInfo(&data.info); |
+ data.info = file_enum.GetInfo(); |
data.path = path; |
file_data.push_back(data); |