diff options
30 files changed, 88 insertions, 143 deletions
diff --git a/base/file_util.cc b/base/file_util.cc index d536475..abc7557 100644 --- a/base/file_util.cc +++ b/base/file_util.cc @@ -170,8 +170,7 @@ bool ReadFileToString(const FilePath& path, std::string* contents) { bool IsDirectoryEmpty(const FilePath& dir_path) { FileEnumerator files(dir_path, false, - static_cast<FileEnumerator::FileType>( - FileEnumerator::FILES | FileEnumerator::DIRECTORIES)); + FileEnumerator::FILES | FileEnumerator::DIRECTORIES); if (files.Next().value().empty()) return true; return false; diff --git a/base/file_util.h b/base/file_util.h index a868112..911ee0d 100644 --- a/base/file_util.h +++ b/base/file_util.h @@ -523,8 +523,8 @@ class BASE_EXPORT FileEnumerator { // files in one directory will be returned before any files in a // subdirectory. // - // |file_type| specifies whether the enumerator should match files, - // directories, or both. + // |file_type|, a bit mask of FileType, specifies whether the enumerator + // should match files, directories, or both. // // |pattern| is an optional pattern for which files to match. This // works like shell globbing. For example, "*.txt" or "Foo???.doc". @@ -537,10 +537,10 @@ class BASE_EXPORT FileEnumerator { // TODO(erikkay): Fix the pattern matching to work at all levels. FileEnumerator(const FilePath& root_path, bool recursive, - FileType file_type); + int file_type); FileEnumerator(const FilePath& root_path, bool recursive, - FileType file_type, + int file_type, const FilePath::StringType& pattern); ~FileEnumerator(); @@ -587,7 +587,7 @@ class BASE_EXPORT FileEnumerator { FilePath root_path_; bool recursive_; - FileType file_type_; + int file_type_; FilePath::StringType pattern_; // Empty when we want to find everything. // A stack that keeps track of which subdirectories we still need to diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc index 6100e10..ed60e06 100644 --- a/base/file_util_posix.cc +++ b/base/file_util_posix.cc @@ -227,9 +227,9 @@ bool Delete(const FilePath& path, bool recursive) { bool success = true; std::stack<std::string> directories; directories.push(path.value()); - FileEnumerator traversal(path, true, static_cast<FileEnumerator::FileType>( - FileEnumerator::FILES | FileEnumerator::DIRECTORIES | - FileEnumerator::SHOW_SYM_LINKS)); + FileEnumerator traversal(path, true, + FileEnumerator::FILES | FileEnumerator::DIRECTORIES | + FileEnumerator::SHOW_SYM_LINKS); for (FilePath current = traversal.Next(); success && !current.empty(); current = traversal.Next()) { FileEnumerator::FindInfo info; @@ -315,12 +315,9 @@ bool CopyDirectory(const FilePath& from_path, return false; bool success = true; - FileEnumerator::FileType traverse_type = - static_cast<FileEnumerator::FileType>(FileEnumerator::FILES | - FileEnumerator::SHOW_SYM_LINKS); + int traverse_type = FileEnumerator::FILES | FileEnumerator::SHOW_SYM_LINKS; if (recursive) - traverse_type = static_cast<FileEnumerator::FileType>( - traverse_type | FileEnumerator::DIRECTORIES); + traverse_type |= FileEnumerator::DIRECTORIES; FileEnumerator traversal(from_path, recursive, traverse_type); // We have to mimic windows behavior here. |to_path| may not exist yet, @@ -743,7 +740,7 @@ bool SetCurrentDirectory(const FilePath& path) { FileEnumerator::FileEnumerator(const FilePath& root_path, bool recursive, - FileType file_type) + int file_type) : current_directory_entry_(0), root_path_(root_path), recursive_(recursive), @@ -755,7 +752,7 @@ FileEnumerator::FileEnumerator(const FilePath& root_path, FileEnumerator::FileEnumerator(const FilePath& root_path, bool recursive, - FileType file_type, + int file_type, const FilePath::StringType& pattern) : current_directory_entry_(0), root_path_(root_path), diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc index b471f88..5a99983 100644 --- a/base/file_util_unittest.cc +++ b/base/file_util_unittest.cc @@ -130,10 +130,8 @@ void ChangePosixFilePermissions(const FilePath& path, const wchar_t bogus_content[] = L"I'm cannon fodder."; -const file_util::FileEnumerator::FileType FILES_AND_DIRECTORIES = - static_cast<file_util::FileEnumerator::FileType>( - file_util::FileEnumerator::FILES | - file_util::FileEnumerator::DIRECTORIES); +const int FILES_AND_DIRECTORIES = + file_util::FileEnumerator::FILES | file_util::FileEnumerator::DIRECTORIES; // file_util winds up using autoreleased objects on the Mac, so this needs // to be a PlatformTest @@ -1867,8 +1865,7 @@ TEST_F(FileUtilTest, FileEnumeratorTest) { // Test an empty directory, non-recursively, including "..". file_util::FileEnumerator f0_dotdot(temp_dir_.path(), false, - static_cast<file_util::FileEnumerator::FileType>( - FILES_AND_DIRECTORIES | file_util::FileEnumerator::INCLUDE_DOT_DOT)); + FILES_AND_DIRECTORIES | file_util::FileEnumerator::INCLUDE_DOT_DOT); EXPECT_EQ(temp_dir_.path().Append(FILE_PATH_LITERAL("..")).value(), f0_dotdot.Next().value()); EXPECT_EQ(FILE_PATH_LITERAL(""), @@ -1923,11 +1920,9 @@ TEST_F(FileUtilTest, FileEnumeratorTest) { EXPECT_EQ(c2_non_recursive.size(), 2); // Only enumerate directories, non-recursively, including "..". - file_util::FileEnumerator f2_dotdot( - temp_dir_.path(), false, - static_cast<file_util::FileEnumerator::FileType>( - file_util::FileEnumerator::DIRECTORIES | - file_util::FileEnumerator::INCLUDE_DOT_DOT)); + file_util::FileEnumerator f2_dotdot(temp_dir_.path(), false, + file_util::FileEnumerator::DIRECTORIES | + file_util::FileEnumerator::INCLUDE_DOT_DOT); FindResultCollector c2_dotdot(f2_dotdot); EXPECT_TRUE(c2_dotdot.HasFile(dir1)); EXPECT_TRUE(c2_dotdot.HasFile(dir2)); diff --git a/base/file_util_win.cc b/base/file_util_win.cc index 6602121..b88e131 100644 --- a/base/file_util_win.cc +++ b/base/file_util_win.cc @@ -799,7 +799,7 @@ bool SetCurrentDirectory(const FilePath& directory) { FileEnumerator::FileEnumerator(const FilePath& root_path, bool recursive, - FileType file_type) + int file_type) : recursive_(recursive), file_type_(file_type), has_find_data_(false), @@ -812,7 +812,7 @@ FileEnumerator::FileEnumerator(const FilePath& root_path, FileEnumerator::FileEnumerator(const FilePath& root_path, bool recursive, - FileType file_type, + int file_type, const FilePath::StringType& pattern) : recursive_(recursive), file_type_(file_type), diff --git a/base/test/test_file_util_posix.cc b/base/test/test_file_util_posix.cc index 67c450f..5ebf3353 100644 --- a/base/test/test_file_util_posix.cc +++ b/base/test/test_file_util_posix.cc @@ -101,9 +101,8 @@ bool CopyRecursiveDirNoCache(const FilePath& source_dir, return false; bool success = true; - FileEnumerator::FileType traverse_type = - static_cast<FileEnumerator::FileType>(FileEnumerator::FILES | - FileEnumerator::SHOW_SYM_LINKS | FileEnumerator::DIRECTORIES); + int traverse_type = FileEnumerator::FILES | + FileEnumerator::SHOW_SYM_LINKS | FileEnumerator::DIRECTORIES; FileEnumerator traversal(source_dir, true, traverse_type); // dest_dir may not exist yet, start the loop with dest_dir diff --git a/chrome/browser/chromeos/gdata/gdata_cache.cc b/chrome/browser/chromeos/gdata/gdata_cache.cc index 036e33b..059e4f0 100644 --- a/chrome/browser/chromeos/gdata/gdata_cache.cc +++ b/chrome/browser/chromeos/gdata/gdata_cache.cc @@ -170,12 +170,10 @@ void DeleteFilesSelectively(const FilePath& path_to_delete_pattern, // base name of |path_to_delete_pattern|. // If a file is not |path_to_keep|, delete it. bool success = true; - file_util::FileEnumerator enumerator( - path_to_delete_pattern.DirName(), + file_util::FileEnumerator enumerator(path_to_delete_pattern.DirName(), false, // not recursive - static_cast<file_util::FileEnumerator::FileType>( - file_util::FileEnumerator::FILES | - file_util::FileEnumerator::SHOW_SYM_LINKS), + file_util::FileEnumerator::FILES | + file_util::FileEnumerator::SHOW_SYM_LINKS, path_to_delete_pattern.BaseName().value()); for (FilePath current = enumerator.Next(); !current.empty(); current = enumerator.Next()) { diff --git a/chrome/browser/chromeos/gdata/gdata_cache_metadata.cc b/chrome/browser/chromeos/gdata/gdata_cache_metadata.cc index 0736af9..0128806 100644 --- a/chrome/browser/chromeos/gdata/gdata_cache_metadata.cc +++ b/chrome/browser/chromeos/gdata/gdata_cache_metadata.cc @@ -110,12 +110,10 @@ void ScanCacheDirectory( DCHECK(cache_map); DCHECK(processed_file_map); - file_util::FileEnumerator enumerator( - cache_paths[sub_dir_type], + file_util::FileEnumerator enumerator(cache_paths[sub_dir_type], false, // not recursive - static_cast<file_util::FileEnumerator::FileType>( - file_util::FileEnumerator::FILES | - file_util::FileEnumerator::SHOW_SYM_LINKS), + file_util::FileEnumerator::FILES | + file_util::FileEnumerator::SHOW_SYM_LINKS, util::kWildCard); for (FilePath current = enumerator.Next(); !current.empty(); current = enumerator.Next()) { diff --git a/chrome/browser/chromeos/gdata/gdata_cache_unittest.cc b/chrome/browser/chromeos/gdata/gdata_cache_unittest.cc index 31eef38..449dd6d 100644 --- a/chrome/browser/chromeos/gdata/gdata_cache_unittest.cc +++ b/chrome/browser/chromeos/gdata/gdata_cache_unittest.cc @@ -375,9 +375,8 @@ class GDataCacheTest : public testing::Test { for (size_t i = 0; i < paths_to_verify.size(); ++i) { file_util::FileEnumerator enumerator( paths_to_verify[i].path_to_scan.DirName(), false /* not recursive*/, - static_cast<file_util::FileEnumerator::FileType>( - file_util::FileEnumerator::FILES | - file_util::FileEnumerator::SHOW_SYM_LINKS), + file_util::FileEnumerator::FILES | + file_util::FileEnumerator::SHOW_SYM_LINKS, paths_to_verify[i].path_to_scan.BaseName().value()); EXPECT_TRUE(enumerator.Next().empty()); } @@ -415,10 +414,9 @@ class GDataCacheTest : public testing::Test { for (size_t i = 0; i < paths_to_verify.size(); ++i) { const struct PathToVerify& verify = paths_to_verify[i]; file_util::FileEnumerator enumerator( - verify.path_to_scan.DirName(), false /* not recursive*/, - static_cast<file_util::FileEnumerator::FileType>( - file_util::FileEnumerator::FILES | - file_util::FileEnumerator::SHOW_SYM_LINKS), + verify.path_to_scan.DirName(), false /* not recursive */, + file_util::FileEnumerator::FILES | + file_util::FileEnumerator::SHOW_SYM_LINKS, verify.path_to_scan.BaseName().value()); size_t num_files_found = 0; for (FilePath current = enumerator.Next(); !current.empty(); diff --git a/chrome/browser/chromeos/login/camera_detector.cc b/chrome/browser/chromeos/login/camera_detector.cc index 9c4bc27..4156c8e 100644 --- a/chrome/browser/chromeos/login/camera_detector.cc +++ b/chrome/browser/chromeos/login/camera_detector.cc @@ -57,10 +57,8 @@ void CameraDetector::CheckPresence() { // device may trigger costly device initialization. using file_util::FileEnumerator; FileEnumerator file_enum( - FilePath(kV4LSubsystemDir), - false, // Don't recurse. - static_cast<FileEnumerator::FileType>( - FileEnumerator::FILES | FileEnumerator::SHOW_SYM_LINKS)); + FilePath(kV4LSubsystemDir), false /* not recursive */, + FileEnumerator::FILES | FileEnumerator::SHOW_SYM_LINKS); for (FilePath path = file_enum.Next(); !path.empty(); path = file_enum.Next()) { std::string v4l_capabilities; diff --git a/chrome/browser/extensions/api/serial/serial_port_enumerator_posix.cc b/chrome/browser/extensions/api/serial/serial_port_enumerator_posix.cc index c069ebb..6afad8f 100644 --- a/chrome/browser/extensions/api/serial/serial_port_enumerator_posix.cc +++ b/chrome/browser/extensions/api/serial/serial_port_enumerator_posix.cc @@ -65,16 +65,15 @@ SerialPortEnumerator::StringSet SerialPortEnumerator::GenerateValidPatterns() { SerialPortEnumerator::StringSet SerialPortEnumerator::GenerateValidSerialPortNames() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - const FilePath DEV_ROOT("/dev"); - const file_util::FileEnumerator::FileType FILES_AND_SYM_LINKS = - static_cast<file_util::FileEnumerator::FileType>( - file_util::FileEnumerator::FILES | - file_util::FileEnumerator::SHOW_SYM_LINKS); + const FilePath kDevRoot("/dev"); + const int kFilesAndSymLinks = + file_util::FileEnumerator::FILES | + file_util::FileEnumerator::SHOW_SYM_LINKS; StringSet valid_patterns = GenerateValidPatterns(); StringSet name_set; file_util::FileEnumerator enumerator( - DEV_ROOT, false, FILES_AND_SYM_LINKS); + kDevRoot, false, kFilesAndSymLinks); do { const FilePath next_device_path(enumerator.Next()); const std::string next_device = next_device_path.value(); diff --git a/chrome/browser/extensions/sandboxed_unpacker_unittest.cc b/chrome/browser/extensions/sandboxed_unpacker_unittest.cc index 3be80b2..70f3f0b 100644 --- a/chrome/browser/extensions/sandboxed_unpacker_unittest.cc +++ b/chrome/browser/extensions/sandboxed_unpacker_unittest.cc @@ -135,10 +135,8 @@ class SandboxedUnpackerTest : public testing::Test { bool TempFilesRemoved() { // Check that temporary files were cleaned up. - file_util::FileEnumerator::FileType files_and_dirs = - static_cast<file_util::FileEnumerator::FileType>( - file_util::FileEnumerator::DIRECTORIES | - file_util::FileEnumerator::FILES); + int files_and_dirs = file_util::FileEnumerator::DIRECTORIES | + file_util::FileEnumerator::FILES; file_util::FileEnumerator temp_iterator( temp_path_, diff --git a/chrome/browser/policy/app_pack_updater.cc b/chrome/browser/policy/app_pack_updater.cc index 20d5f20..da42337 100644 --- a/chrome/browser/policy/app_pack_updater.cc +++ b/chrome/browser/policy/app_pack_updater.cc @@ -277,9 +277,8 @@ void AppPackUpdater::BlockingCheckCacheInternal( // Enumerate all the files in the cache |dir|, including directories // and symlinks. Each unrecognized file will be erased. - FileEnumerator::FileType types = static_cast<FileEnumerator::FileType>( - FileEnumerator::FILES | FileEnumerator::DIRECTORIES | - FileEnumerator::SHOW_SYM_LINKS); + int types = FileEnumerator::FILES | FileEnumerator::DIRECTORIES | + FileEnumerator::SHOW_SYM_LINKS; FileEnumerator enumerator(dir, false /* recursive */, types); for (FilePath path = enumerator.Next(); diff --git a/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc b/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc index 1bc509c..8a87562 100644 --- a/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc +++ b/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc @@ -48,10 +48,7 @@ void GetGCacheContents(const FilePath& root_path, const int options = (file_util::FileEnumerator::FILES | file_util::FileEnumerator::DIRECTORIES | file_util::FileEnumerator::SHOW_SYM_LINKS); - FileEnumerator enumerator( - root_path, - true, // recursive - static_cast<FileEnumerator::FileType>(options)); + FileEnumerator enumerator(root_path, true /* recursive */, options); int64 total_size = 0; for (FilePath current = enumerator.Next(); !current.empty(); diff --git a/chrome/common/extensions/extension_file_util.cc b/chrome/common/extensions/extension_file_util.cc index c02c829..7b92b93 100644 --- a/chrome/common/extensions/extension_file_util.cc +++ b/chrome/common/extensions/extension_file_util.cc @@ -651,12 +651,10 @@ bool CheckForIllegalFilenames(const FilePath& extension_path, // Enumerate all files and directories in the extension root. // There is a problem when using pattern "_*" with FileEnumerator, so we have // to cheat with find_first_of and match all. + const int kFilesAndDirectories = + file_util::FileEnumerator::DIRECTORIES | file_util::FileEnumerator::FILES; file_util::FileEnumerator all_files( - extension_path, - false, - static_cast<file_util::FileEnumerator::FileType>( - file_util::FileEnumerator::DIRECTORIES | - file_util::FileEnumerator::FILES)); + extension_path, false, kFilesAndDirectories); FilePath file; while (!(file = all_files.Next()).empty()) { diff --git a/chrome/common/zip.cc b/chrome/common/zip.cc index ef50ead..18a845a 100644 --- a/chrome/common/zip.cc +++ b/chrome/common/zip.cc @@ -130,11 +130,9 @@ bool ZipWithFilterCallback(const FilePath& src_dir, const FilePath& dest_file, } bool success = true; - file_util::FileEnumerator file_enumerator( - src_dir, true, // recursive - static_cast<file_util::FileEnumerator::FileType>( - file_util::FileEnumerator::FILES | - file_util::FileEnumerator::DIRECTORIES)); + file_util::FileEnumerator file_enumerator(src_dir, true /* recursive */, + file_util::FileEnumerator::FILES | + file_util::FileEnumerator::DIRECTORIES); for (FilePath path = file_enumerator.Next(); !path.value().empty(); path = file_enumerator.Next()) { if (!filter_cb.Run(path)) { diff --git a/chrome/common/zip_unittest.cc b/chrome/common/zip_unittest.cc index 6c857e17..3176260 100644 --- a/chrome/common/zip_unittest.cc +++ b/chrome/common/zip_unittest.cc @@ -53,9 +53,8 @@ class ZipTest : public PlatformTest { ASSERT_TRUE(zip::Unzip(path, test_dir_)); file_util::FileEnumerator files(test_dir_, true, - static_cast<file_util::FileEnumerator::FileType>( - file_util::FileEnumerator::FILES | - file_util::FileEnumerator::DIRECTORIES)); + file_util::FileEnumerator::FILES | + file_util::FileEnumerator::DIRECTORIES); FilePath next_path = files.Next(); size_t count = 0; while (!next_path.value().empty()) { diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index f4c4d70..bad833b 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc @@ -466,11 +466,8 @@ DeleteResult DeleteChromeFilesAndFolders(const InstallerState& installer_state, DeleteResult result = DELETE_SUCCEEDED; using file_util::FileEnumerator; - FileEnumerator file_enumerator( - target_path, - false, - static_cast<FileEnumerator::FileType>(FileEnumerator::FILES | - FileEnumerator::DIRECTORIES)); + FileEnumerator file_enumerator(target_path, false, + FileEnumerator::FILES | FileEnumerator::DIRECTORIES); while (true) { FilePath to_delete(file_enumerator.Next()); if (to_delete.empty()) diff --git a/chrome/installer/util/duplicate_tree_detector.cc b/chrome/installer/util/duplicate_tree_detector.cc index cc80f0c..ec4f115 100644 --- a/chrome/installer/util/duplicate_tree_detector.cc +++ b/chrome/installer/util/duplicate_tree_detector.cc @@ -28,11 +28,8 @@ bool IsIdenticalFileHierarchy(const FilePath& src_path, // "identical" to all the entries in src_path. is_identical = true; - FileEnumerator path_enum( - src_path, - false, // Not recursive - static_cast<FileEnumerator::FileType>( - FileEnumerator::FILES | FileEnumerator::DIRECTORIES)); + FileEnumerator path_enum(src_path, false /* not recursive */, + FileEnumerator::FILES | FileEnumerator::DIRECTORIES); for (FilePath path = path_enum.Next(); is_identical && !path.empty(); path = path_enum.Next()) { is_identical = diff --git a/chrome/test/webdriver/webdriver_util.cc b/chrome/test/webdriver/webdriver_util.cc index 66754a8..5a4cd75 100644 --- a/chrome/test/webdriver/webdriver_util.cc +++ b/chrome/test/webdriver/webdriver_util.cc @@ -373,9 +373,8 @@ bool UnzipSoleFile(const FilePath& unzip_dir, } file_util::FileEnumerator enumerator(unzip_dir, false /* recursive */, - static_cast<file_util::FileEnumerator::FileType>( - file_util::FileEnumerator::FILES | - file_util::FileEnumerator::DIRECTORIES)); + file_util::FileEnumerator::FILES | + file_util::FileEnumerator::DIRECTORIES); FilePath first_file = enumerator.Next(); if (first_file.empty()) { *error_msg = "Zip contained 0 files"; diff --git a/chrome/tools/profiles/generate_profile.cc b/chrome/tools/profiles/generate_profile.cc index ab7bbdf..47a8ea1 100644 --- a/chrome/tools/profiles/generate_profile.cc +++ b/chrome/tools/profiles/generate_profile.cc @@ -268,10 +268,8 @@ int main(int argc, const char* argv[]) { message_loop.RunAllPending(); - file_util::FileEnumerator file_iterator( - profile.GetPath(), false, - static_cast<file_util::FileEnumerator::FileType>( - file_util::FileEnumerator::FILES)); + file_util::FileEnumerator file_iterator(profile.GetPath(), false, + file_util::FileEnumerator::FILES); FilePath path = file_iterator.Next(); while (!path.empty()) { FilePath dst_file = dst_dir.Append(path.BaseName()); diff --git a/content/browser/renderer_host/pepper/pepper_file_message_filter.cc b/content/browser/renderer_host/pepper/pepper_file_message_filter.cc index 9212e6f..5de7fbf 100644 --- a/content/browser/renderer_host/pepper/pepper_file_message_filter.cc +++ b/content/browser/renderer_host/pepper/pepper_file_message_filter.cc @@ -217,12 +217,10 @@ void PepperFileMessageFilter::OnGetDirContents( contents->clear(); - file_util::FileEnumerator enumerator( - full_path, false, - static_cast<file_util::FileEnumerator::FileType>( - file_util::FileEnumerator::FILES | - file_util::FileEnumerator::DIRECTORIES | - file_util::FileEnumerator::INCLUDE_DOT_DOT)); + file_util::FileEnumerator enumerator(full_path, false, + file_util::FileEnumerator::FILES | + file_util::FileEnumerator::DIRECTORIES | + file_util::FileEnumerator::INCLUDE_DOT_DOT); while (!enumerator.Next().empty()) { file_util::FileEnumerator::FindInfo info; diff --git a/net/base/directory_lister.cc b/net/base/directory_lister.cc index d6d3c89..f61b9e3 100644 --- a/net/base/directory_lister.cc +++ b/net/base/directory_lister.cc @@ -164,8 +164,7 @@ void DirectoryLister::Core::StartInternal() { if (!recursive_) types |= file_util::FileEnumerator::INCLUDE_DOT_DOT; - file_util::FileEnumerator file_enum(dir_, recursive_, - static_cast<file_util::FileEnumerator::FileType>(types)); + file_util::FileEnumerator file_enum(dir_, recursive_, types); FilePath path; std::vector<DirectoryListerData> file_data; diff --git a/net/disk_cache/cache_util_posix.cc b/net/disk_cache/cache_util_posix.cc index ec5f931..9c2cf12 100644 --- a/net/disk_cache/cache_util_posix.cc +++ b/net/disk_cache/cache_util_posix.cc @@ -22,12 +22,9 @@ bool MoveCache(const FilePath& from_path, const FilePath& to_path) { LOG(ERROR) << "Unable to create destination cache directory."; return false; } - file_util::FileEnumerator iter( - from_path, - /* recursive */ false, - static_cast<file_util::FileEnumerator::FileType>( - file_util::FileEnumerator::DIRECTORIES | - file_util::FileEnumerator::FILES)); + file_util::FileEnumerator iter(from_path, false /* not recursive */, + file_util::FileEnumerator::DIRECTORIES | + file_util::FileEnumerator::FILES); for (FilePath name = iter.Next(); !name.value().empty(); name = iter.Next()) { FilePath destination = to_path.Append(name.BaseName()); if (!file_util::Move(name, destination)) { diff --git a/webkit/fileapi/file_system_database_test_helper.cc b/webkit/fileapi/file_system_database_test_helper.cc index 28951d08..838173a 100644 --- a/webkit/fileapi/file_system_database_test_helper.cc +++ b/webkit/fileapi/file_system_database_test_helper.cc @@ -19,11 +19,9 @@ void CorruptDatabase(const FilePath& db_path, leveldb::FileType type, ptrdiff_t offset, size_t size) { - file_util::FileEnumerator file_enum( - db_path, false /* recursive */, - static_cast<file_util::FileEnumerator::FileType>( - file_util::FileEnumerator::DIRECTORIES | - file_util::FileEnumerator::FILES)); + file_util::FileEnumerator file_enum(db_path, false /* not recursive */, + file_util::FileEnumerator::DIRECTORIES | + file_util::FileEnumerator::FILES); FilePath file_path; FilePath picked_file_path; uint64 picked_file_number = kuint64max; diff --git a/webkit/fileapi/file_system_directory_database.cc b/webkit/fileapi/file_system_directory_database.cc index 16ec2f8..4023c5a 100644 --- a/webkit/fileapi/file_system_directory_database.cc +++ b/webkit/fileapi/file_system_directory_database.cc @@ -273,10 +273,9 @@ bool DatabaseCheckHelper::ScanDirectory() { file_util::FileEnumerator file_enum( dir_path.empty() ? path_ : path_.Append(dir_path), - false /* recursive */, - static_cast<file_util::FileEnumerator::FileType>( - file_util::FileEnumerator::DIRECTORIES | - file_util::FileEnumerator::FILES)); + false /* not recursive */, + file_util::FileEnumerator::DIRECTORIES | + file_util::FileEnumerator::FILES); FilePath absolute_file_path; while (!(absolute_file_path = file_enum.Next()).empty()) { diff --git a/webkit/fileapi/isolated_file_util_unittest.cc b/webkit/fileapi/isolated_file_util_unittest.cc index acd4fca..d3e6303 100644 --- a/webkit/fileapi/isolated_file_util_unittest.cc +++ b/webkit/fileapi/isolated_file_util_unittest.cc @@ -323,10 +323,8 @@ TEST_F(IsolatedFileUtilTest, ReadDirectoryTest) { EntryMap expected_entry_map; FileEnumerator file_enum( - GetTestCasePlatformPath(test_case.path), - false /* recursive */, - static_cast<file_util::FileEnumerator::FileType>( - FileEnumerator::FILES | FileEnumerator::DIRECTORIES)); + GetTestCasePlatformPath(test_case.path), false /* not recursive */, + FileEnumerator::FILES | FileEnumerator::DIRECTORIES); FilePath current; while (!(current = file_enum.Next()).empty()) { FileEnumerator::FindInfo file_info; diff --git a/webkit/fileapi/local_file_util.cc b/webkit/fileapi/local_file_util.cc index 2bfe172..3274171 100644 --- a/webkit/fileapi/local_file_util.cc +++ b/webkit/fileapi/local_file_util.cc @@ -21,7 +21,7 @@ class LocalFileEnumerator : public FileSystemFileUtil::AbstractFileEnumerator { LocalFileEnumerator(const FilePath& platform_root_path, const FilePath& virtual_root_path, bool recursive, - file_util::FileEnumerator::FileType file_type) + int file_type) : file_enum_(platform_root_path, recursive, file_type), platform_root_path_(platform_root_path), virtual_root_path_(virtual_root_path) { @@ -142,11 +142,9 @@ FileSystemFileUtil::AbstractFileEnumerator* LocalFileUtil::CreateFileEnumerator( if (GetLocalFilePath(context, root_url, &file_path) != base::PLATFORM_FILE_OK) return new EmptyFileEnumerator(); - return new LocalFileEnumerator( - file_path, root_url.path(), recursive, - static_cast<file_util::FileEnumerator::FileType>( - file_util::FileEnumerator::FILES | - file_util::FileEnumerator::DIRECTORIES)); + return new LocalFileEnumerator(file_path, root_url.path(), recursive, + file_util::FileEnumerator::FILES | + file_util::FileEnumerator::DIRECTORIES); } PlatformFileError LocalFileUtil::GetLocalFilePath( diff --git a/webkit/fileapi/native_file_util.cc b/webkit/fileapi/native_file_util.cc index 6a9d5cd..995a9e9 100644 --- a/webkit/fileapi/native_file_util.cc +++ b/webkit/fileapi/native_file_util.cc @@ -39,7 +39,7 @@ class NativeFileEnumerator : public FileSystemFileUtil::AbstractFileEnumerator { public: NativeFileEnumerator(const FilePath& root_path, bool recursive, - file_util::FileEnumerator::FileType file_type) + int file_type) : file_enum_(root_path, recursive, file_type) { #if defined(OS_WIN) memset(&file_util_info_, 0, sizeof(file_util_info_)); @@ -158,11 +158,9 @@ PlatformFileError NativeFileUtil::GetFileInfo( FileSystemFileUtil::AbstractFileEnumerator* NativeFileUtil::CreateFileEnumerator(const FilePath& root_path, bool recursive) { - return new NativeFileEnumerator( - root_path, recursive, - static_cast<file_util::FileEnumerator::FileType>( - file_util::FileEnumerator::FILES | - file_util::FileEnumerator::DIRECTORIES)); + return new NativeFileEnumerator(root_path, recursive, + file_util::FileEnumerator::FILES | + file_util::FileEnumerator::DIRECTORIES); } PlatformFileError NativeFileUtil::Touch( diff --git a/webkit/fileapi/obfuscated_file_util.cc b/webkit/fileapi/obfuscated_file_util.cc index b23ba78..9db406d 100644 --- a/webkit/fileapi/obfuscated_file_util.cc +++ b/webkit/fileapi/obfuscated_file_util.cc @@ -996,9 +996,8 @@ bool ObfuscatedFileUtil::MigrateFromOldSandbox( return false; file_util::FileEnumerator file_enum(src_root, true, - static_cast<file_util::FileEnumerator::FileType>( - file_util::FileEnumerator::FILES | - file_util::FileEnumerator::DIRECTORIES)); + file_util::FileEnumerator::FILES | + file_util::FileEnumerator::DIRECTORIES); FilePath src_full_path; size_t root_path_length = src_root.value().length() + 1; // +1 for the slash while (!(src_full_path = file_enum.Next()).empty()) { |