diff options
Diffstat (limited to 'chrome/browser')
35 files changed, 139 insertions, 135 deletions
diff --git a/chrome/browser/browsing_data/browsing_data_local_storage_helper_browsertest.cc b/chrome/browser/browsing_data/browsing_data_local_storage_helper_browsertest.cc index 75e2a32..7273bc2 100644 --- a/chrome/browser/browsing_data/browsing_data_local_storage_helper_browsertest.cc +++ b/chrome/browser/browsing_data/browsing_data_local_storage_helper_browsertest.cc @@ -9,6 +9,7 @@ #include "base/bind_helpers.h" #include "base/callback.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/files/file_path.h" #include "base/memory/ref_counted.h" #include "base/test/thread_test_helper.h" @@ -128,10 +129,10 @@ IN_PROC_BROWSER_TEST_F(BrowsingDataLocalStorageHelperTest, DeleteSingleFile) { BrowserThread::GetBlockingPool()->FlushForTesting(); // Ensure the file has been deleted. - file_util::FileEnumerator file_enumerator( + base::FileEnumerator file_enumerator( GetLocalStoragePathForTestingProfile(), false, - file_util::FileEnumerator::FILES); + base::FileEnumerator::FILES); int num_files = 0; for (base::FilePath file_path = file_enumerator.Next(); !file_path.empty(); diff --git a/chrome/browser/chromeos/camera_detector.cc b/chrome/browser/chromeos/camera_detector.cc index e7fddb9..3d5d039 100644 --- a/chrome/browser/chromeos/camera_detector.cc +++ b/chrome/browser/chromeos/camera_detector.cc @@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/location.h" #include "base/string_util.h" #include "base/strings/string_split.h" @@ -66,10 +67,9 @@ void CameraDetector::OnPresenceCheckDone(const base::Closure& callback, bool CameraDetector::CheckPresence() { // We do a quick check using udev database because opening each /dev/videoX // device may trigger costly device initialization. - using file_util::FileEnumerator; - FileEnumerator file_enum( + base::FileEnumerator file_enum( base::FilePath(kV4LSubsystemDir), false /* not recursive */, - FileEnumerator::FILES | FileEnumerator::SHOW_SYM_LINKS); + base::FileEnumerator::FILES | base::FileEnumerator::SHOW_SYM_LINKS); for (base::FilePath path = file_enum.Next(); !path.empty(); path = file_enum.Next()) { std::string v4l_capabilities; diff --git a/chrome/browser/chromeos/contacts/contact_database_unittest.cc b/chrome/browser/chromeos/contacts/contact_database_unittest.cc index f45addd..e6d88d5 100644 --- a/chrome/browser/chromeos/contacts/contact_database_unittest.cc +++ b/chrome/browser/chromeos/contacts/contact_database_unittest.cc @@ -8,6 +8,7 @@ #include "base/bind.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/files/file_path.h" #include "base/files/scoped_temp_dir.h" #include "base/memory/scoped_ptr.h" @@ -314,8 +315,8 @@ TEST_F(ContactDatabaseTest, FullAndIncrementalUpdates) { TEST_F(ContactDatabaseTest, DeleteWhenCorrupt) { DestroyDatabase(); // Overwrite all of the files in the database with a space character. - file_util::FileEnumerator enumerator( - database_path(), false, file_util::FileEnumerator::FILES); + base::FileEnumerator enumerator( + database_path(), false, base::FileEnumerator::FILES); for (base::FilePath path = enumerator.Next(); !path.empty(); path = enumerator.Next()) { file_util::WriteFile(path, " ", 1); diff --git a/chrome/browser/chromeos/drive/file_cache.cc b/chrome/browser/chromeos/drive/file_cache.cc index 8c43f71..d93e0df 100644 --- a/chrome/browser/chromeos/drive/file_cache.cc +++ b/chrome/browser/chromeos/drive/file_cache.cc @@ -7,6 +7,7 @@ #include <vector> #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/logging.h" #include "base/string_util.h" #include "base/stringprintf.h" @@ -61,10 +62,8 @@ bool InitCachePaths(const std::vector<base::FilePath>& cache_paths) { // Do not remove recursively as we don't want to touch <gcache>/tmp/downloads, // which is used for user initiated downloads like "Save As" void RemoveAllFiles(const base::FilePath& directory) { - using file_util::FileEnumerator; - - FileEnumerator enumerator(directory, false /* recursive */, - FileEnumerator::FILES); + base::FileEnumerator enumerator(directory, false /* recursive */, + base::FileEnumerator::FILES); for (base::FilePath file_path = enumerator.Next(); !file_path.empty(); file_path = enumerator.Next()) { DVLOG(1) << "Removing " << file_path.value(); @@ -107,10 +106,10 @@ void DeleteFilesSelectively(const base::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( + base::FileEnumerator enumerator( path_to_delete_pattern.DirName(), false, // not recursive - file_util::FileEnumerator::FILES, + base::FileEnumerator::FILES, path_to_delete_pattern.BaseName().value()); for (base::FilePath current = enumerator.Next(); !current.empty(); current = enumerator.Next()) { diff --git a/chrome/browser/chromeos/drive/file_cache_metadata.cc b/chrome/browser/chromeos/drive/file_cache_metadata.cc index 6b443da..ab1ad88 100644 --- a/chrome/browser/chromeos/drive/file_cache_metadata.cc +++ b/chrome/browser/chromeos/drive/file_cache_metadata.cc @@ -6,6 +6,7 @@ #include "base/callback.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/metrics/histogram.h" #include "base/sequenced_task_runner.h" #include "base/threading/thread_restrictions.h" @@ -43,10 +44,10 @@ void ScanCacheDirectory(const std::vector<base::FilePath>& cache_paths, DCHECK(cache_map); DCHECK(processed_file_map); - file_util::FileEnumerator enumerator(cache_paths[sub_dir_type], - false, // not recursive - file_util::FileEnumerator::FILES, - util::kWildCard); + base::FileEnumerator enumerator(cache_paths[sub_dir_type], + false, // not recursive + base::FileEnumerator::FILES, + util::kWildCard); for (base::FilePath current = enumerator.Next(); !current.empty(); current = enumerator.Next()) { // Extract resource_id and md5 from filename. diff --git a/chrome/browser/chromeos/drive/file_cache_unittest.cc b/chrome/browser/chromeos/drive/file_cache_unittest.cc index 078a6d1..b2b409b 100644 --- a/chrome/browser/chromeos/drive/file_cache_unittest.cc +++ b/chrome/browser/chromeos/drive/file_cache_unittest.cc @@ -8,6 +8,7 @@ #include <vector> #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/files/scoped_temp_dir.h" #include "base/message_loop.h" #include "base/threading/sequenced_worker_pool.h" @@ -162,9 +163,9 @@ class FileCacheTestOnUIThread : public testing::Test { // Returns number of files matching to |path_pattern|. int CountFilesWithPathPattern(const base::FilePath& path_pattern) { int result = 0; - file_util::FileEnumerator enumerator( + base::FileEnumerator enumerator( path_pattern.DirName(), false /* not recursive*/, - file_util::FileEnumerator::FILES, + base::FileEnumerator::FILES, path_pattern.BaseName().value()); for (base::FilePath current = enumerator.Next(); !current.empty(); current = enumerator.Next()) @@ -481,9 +482,9 @@ class FileCacheTestOnUIThread : public testing::Test { FileCache::CACHE_TYPE_PERSISTENT : FileCache::CACHE_TYPE_TMP), FileCache::CACHED_FILE_FROM_SERVER); - file_util::FileEnumerator enumerator(path.DirName(), false, - file_util::FileEnumerator::FILES, - path.BaseName().value()); + base::FileEnumerator enumerator(path.DirName(), false, + base::FileEnumerator::FILES, + path.BaseName().value()); size_t num_files_found = 0; for (base::FilePath current = enumerator.Next(); !current.empty(); current = enumerator.Next()) { diff --git a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc index ac32448..d2a855e 100644 --- a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc +++ b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc @@ -10,6 +10,7 @@ #include "ash/wm/window_cycle_controller.h" #include "ash/wm/window_util.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/json/json_writer.h" #include "base/memory/scoped_ptr.h" #include "base/path_service.h" @@ -885,8 +886,8 @@ void WallpaperPrivateGetOfflineWallpaperListFunction::GetList( base::FilePath wallpaper_dir; CHECK(PathService::Get(chrome::DIR_CHROMEOS_WALLPAPERS, &wallpaper_dir)); if (file_util::DirectoryExists(wallpaper_dir)) { - file_util::FileEnumerator files(wallpaper_dir, false, - file_util::FileEnumerator::FILES); + base::FileEnumerator files(wallpaper_dir, false, + base::FileEnumerator::FILES); for (base::FilePath current = files.Next(); !current.empty(); current = files.Next()) { std::string file_name = current.BaseName().RemoveExtension().value(); @@ -899,8 +900,8 @@ void WallpaperPrivateGetOfflineWallpaperListFunction::GetList( base::FilePath custom_thumbnails_dir = chromeos::WallpaperManager::Get()-> GetCustomWallpaperPath(chromeos::kThumbnailWallpaperSubDir, email, ""); if (file_util::DirectoryExists(custom_thumbnails_dir)) { - file_util::FileEnumerator files(custom_thumbnails_dir, false, - file_util::FileEnumerator::FILES); + base::FileEnumerator files(custom_thumbnails_dir, false, + base::FileEnumerator::FILES); std::set<std::string> file_name_set; for (base::FilePath current = files.Next(); !current.empty(); current = files.Next()) { diff --git a/chrome/browser/chromeos/login/wallpaper_manager.cc b/chrome/browser/chromeos/login/wallpaper_manager.cc index 25ef809..5015549 100644 --- a/chrome/browser/chromeos/login/wallpaper_manager.cc +++ b/chrome/browser/chromeos/login/wallpaper_manager.cc @@ -9,6 +9,7 @@ #include "ash/shell.h" #include "base/command_line.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/files/file_path.h" #include "base/logging.h" #include "base/metrics/histogram.h" @@ -685,8 +686,7 @@ void WallpaperManager::ClearObsoleteWallpaperPrefs() { void WallpaperManager::DeleteAllExcept(const base::FilePath& path) { base::FilePath dir = path.DirName(); if (file_util::DirectoryExists(dir)) { - file_util::FileEnumerator files(dir, false, - file_util::FileEnumerator::FILES); + base::FileEnumerator files(dir, false, base::FileEnumerator::FILES); for (base::FilePath current = files.Next(); !current.empty(); current = files.Next()) { if (current != path) diff --git a/chrome/browser/chromeos/policy/app_pack_updater.cc b/chrome/browser/chromeos/policy/app_pack_updater.cc index 61fe56f..156402a5 100644 --- a/chrome/browser/chromeos/policy/app_pack_updater.cc +++ b/chrome/browser/chromeos/policy/app_pack_updater.cc @@ -7,6 +7,7 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/location.h" #include "base/stl_util.h" #include "base/string_util.h" @@ -29,7 +30,6 @@ #include "content/public/browser/notification_source.h" using content::BrowserThread; -using file_util::FileEnumerator; namespace policy { @@ -250,18 +250,16 @@ void AppPackUpdater::BlockingCheckCacheInternal( // Enumerate all the files in the cache |dir|, including directories // and symlinks. Each unrecognized file will be erased. - int types = FileEnumerator::FILES | FileEnumerator::DIRECTORIES | - FileEnumerator::SHOW_SYM_LINKS; - FileEnumerator enumerator(dir, false /* recursive */, types); + int types = base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES | + base::FileEnumerator::SHOW_SYM_LINKS; + base::FileEnumerator enumerator(dir, false /* recursive */, types); for (base::FilePath path = enumerator.Next(); !path.empty(); path = enumerator.Next()) { - FileEnumerator::FindInfo info; - enumerator.GetFindInfo(&info); + base::FileEnumerator::FileInfo info = enumerator.GetInfo(); std::string basename = path.BaseName().value(); - if (FileEnumerator::IsDirectory(info) || - file_util::IsLink(FileEnumerator::GetFilename(info))) { + if (info.IsDirectory() || file_util::IsLink(info.GetName())) { LOG(ERROR) << "Erasing bad file in AppPack directory: " << basename; file_util::Delete(path, true /* recursive */); continue; diff --git a/chrome/browser/component_updater/pepper_flash_component_installer.cc b/chrome/browser/component_updater/pepper_flash_component_installer.cc index 98396ca..853ca4e 100644 --- a/chrome/browser/component_updater/pepper_flash_component_installer.cc +++ b/chrome/browser/component_updater/pepper_flash_component_installer.cc @@ -13,6 +13,7 @@ #include "base/command_line.h" #include "base/compiler_specific.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/files/file_path.h" #include "base/logging.h" #include "base/path_service.h" @@ -95,8 +96,8 @@ bool GetPepperFlashDirectory(base::FilePath* latest_dir, std::vector<base::FilePath>* older_dirs) { base::FilePath base_dir = GetPepperFlashBaseDirectory(); bool found = false; - file_util::FileEnumerator - file_enumerator(base_dir, false, file_util::FileEnumerator::DIRECTORIES); + base::FileEnumerator + file_enumerator(base_dir, false, base::FileEnumerator::DIRECTORIES); for (base::FilePath path = file_enumerator.Next(); !path.value().empty(); path = file_enumerator.Next()) { Version version(path.BaseName().MaybeAsASCII()); diff --git a/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc b/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc index 89fb2c2..995c80d 100644 --- a/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc +++ b/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc @@ -9,6 +9,7 @@ #include "base/command_line.h" #include "base/compiler_specific.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/files/file_path.h" #include "base/json/json_file_value_serializer.h" #include "base/logging.h" @@ -126,8 +127,8 @@ bool GetLatestPnaclDirectory(PnaclComponentInstaller* pci, // Enumerate all versions starting from the base directory. base::FilePath base_dir = pci->GetPnaclBaseDirectory(); bool found = false; - file_util::FileEnumerator - file_enumerator(base_dir, false, file_util::FileEnumerator::DIRECTORIES); + base::FileEnumerator + file_enumerator(base_dir, false, base::FileEnumerator::DIRECTORIES); for (base::FilePath path = file_enumerator.Next(); !path.value().empty(); path = file_enumerator.Next()) { Version version(path.BaseName().MaybeAsASCII()); diff --git a/chrome/browser/component_updater/swiftshader_component_installer.cc b/chrome/browser/component_updater/swiftshader_component_installer.cc index 42e8ffc..2f9f527 100644 --- a/chrome/browser/component_updater/swiftshader_component_installer.cc +++ b/chrome/browser/component_updater/swiftshader_component_installer.cc @@ -9,6 +9,7 @@ #include "base/compiler_specific.h" #include "base/cpu.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/files/file_path.h" #include "base/logging.h" #include "base/path_service.h" @@ -63,8 +64,8 @@ bool GetLatestSwiftShaderDirectory(base::FilePath* result, std::vector<base::FilePath>* older_dirs) { base::FilePath base_dir = GetSwiftShaderBaseDirectory(); bool found = false; - file_util::FileEnumerator - file_enumerator(base_dir, false, file_util::FileEnumerator::DIRECTORIES); + base::FileEnumerator + file_enumerator(base_dir, false, base::FileEnumerator::DIRECTORIES); for (base::FilePath path = file_enumerator.Next(); !path.value().empty(); path = file_enumerator.Next()) { Version version(path.BaseName().MaybeAsASCII()); diff --git a/chrome/browser/component_updater/widevine_cdm_component_installer.cc b/chrome/browser/component_updater/widevine_cdm_component_installer.cc index 936d710..170aad3 100644 --- a/chrome/browser/component_updater/widevine_cdm_component_installer.cc +++ b/chrome/browser/component_updater/widevine_cdm_component_installer.cc @@ -13,6 +13,7 @@ #include "base/command_line.h" #include "base/compiler_specific.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/files/file_path.h" #include "base/logging.h" #include "base/path_service.h" @@ -93,8 +94,8 @@ bool GetWidevineCdmDirectory(base::FilePath* latest_dir, std::vector<base::FilePath>* older_dirs) { base::FilePath base_dir = GetWidevineCdmBaseDirectory(); bool found = false; - file_util::FileEnumerator file_enumerator( - base_dir, false, file_util::FileEnumerator::DIRECTORIES); + base::FileEnumerator file_enumerator( + base_dir, false, base::FileEnumerator::DIRECTORIES); for (base::FilePath path = file_enumerator.Next(); !path.value().empty(); path = file_enumerator.Next()) { base::Version version(path.BaseName().MaybeAsASCII()); diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chrome/browser/extensions/api/developer_private/developer_private_api.cc index 67ae7f6..7b077e3 100644 --- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc +++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc @@ -8,6 +8,7 @@ #include "base/base64.h" #include "base/command_line.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/i18n/file_util_icu.h" #include "base/strings/string_number_conversions.h" #include "base/utf_string_conversions.h" @@ -85,9 +86,8 @@ GURL ToDataURL(const base::FilePath& path) { } std::vector<base::FilePath> ListFolder(const base::FilePath path) { - file_util::FileEnumerator files(path, false, - file_util::FileEnumerator::DIRECTORIES - | file_util::FileEnumerator::FILES); + base::FileEnumerator files(path, false, + base::FileEnumerator::DIRECTORIES | base::FileEnumerator::FILES); std::vector<base::FilePath> paths; for (base::FilePath current_path = files.Next(); !current_path.empty(); 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 ce29ea5..505d8b0 100644 --- a/chrome/browser/extensions/api/serial/serial_port_enumerator_posix.cc +++ b/chrome/browser/extensions/api/serial/serial_port_enumerator_posix.cc @@ -5,6 +5,7 @@ #include "chrome/browser/extensions/api/serial/serial_port_enumerator.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/files/file_path.h" #include "base/string_util.h" #include "content/public/browser/browser_thread.h" @@ -67,13 +68,12 @@ SerialPortEnumerator::GenerateValidSerialPortNames() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); const base::FilePath kDevRoot("/dev"); const int kFilesAndSymLinks = - file_util::FileEnumerator::FILES | - file_util::FileEnumerator::SHOW_SYM_LINKS; + base::FileEnumerator::FILES | + base::FileEnumerator::SHOW_SYM_LINKS; StringSet valid_patterns = GenerateValidPatterns(); StringSet name_set; - file_util::FileEnumerator enumerator( - kDevRoot, false, kFilesAndSymLinks); + base::FileEnumerator enumerator(kDevRoot, false, kFilesAndSymLinks); do { const base::FilePath next_device_path(enumerator.Next()); const std::string next_device = next_device_path.value(); diff --git a/chrome/browser/extensions/api/storage/settings_backend.cc b/chrome/browser/extensions/api/storage/settings_backend.cc index fbcdd17..e1a5d37 100644 --- a/chrome/browser/extensions/api/storage/settings_backend.cc +++ b/chrome/browser/extensions/api/storage/settings_backend.cc @@ -4,7 +4,7 @@ #include "chrome/browser/extensions/api/storage/settings_backend.h" -#include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/logging.h" #include "chrome/browser/extensions/api/storage/settings_sync_processor.h" #include "chrome/browser/extensions/api/storage/settings_sync_util.h" @@ -115,13 +115,10 @@ std::set<std::string> SettingsBackend::GetKnownExtensionIDs() const { } // Leveldb databases are directories inside base_path_. - file_util::FileEnumerator::FindInfo find_info; - file_util::FileEnumerator extension_dirs( - base_path_, false, file_util::FileEnumerator::DIRECTORIES); + base::FileEnumerator extension_dirs( + base_path_, false, base::FileEnumerator::DIRECTORIES); while (!extension_dirs.Next().empty()) { - extension_dirs.GetFindInfo(&find_info); - base::FilePath extension_dir( - file_util::FileEnumerator::GetFilename(find_info)); + base::FilePath extension_dir = extension_dirs.GetInfo().GetName(); DCHECK(!extension_dir.IsAbsolute()); // Extension IDs are created as std::strings so they *should* be ASCII. std::string maybe_as_ascii(extension_dir.MaybeAsASCII()); diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index 37056cc..7d32219 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -13,6 +13,7 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/files/scoped_temp_dir.h" #include "base/json/json_file_value_serializer.h" #include "base/json/json_reader.h" @@ -1354,8 +1355,8 @@ TEST_F(ExtensionServiceTest, CleanupOnStartup) { // Wait for GarbageCollectExtensions task to complete. loop_.RunUntilIdle(); - file_util::FileEnumerator dirs(extensions_install_dir_, false, - file_util::FileEnumerator::DIRECTORIES); + base::FileEnumerator dirs(extensions_install_dir_, false, + base::FileEnumerator::DIRECTORIES); size_t count = 0; while (!dirs.Next().empty()) count++; diff --git a/chrome/browser/extensions/external_pref_loader.cc b/chrome/browser/extensions/external_pref_loader.cc index 403275a..cf02d9e 100644 --- a/chrome/browser/extensions/external_pref_loader.cc +++ b/chrome/browser/extensions/external_pref_loader.cc @@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/files/file_path.h" #include "base/json/json_file_value_serializer.h" #include "base/json/json_string_value_serializer.h" @@ -35,10 +36,10 @@ std::set<base::FilePath> GetPrefsCandidateFilesFromFolder( return external_extension_paths; } - file_util::FileEnumerator json_files( + base::FileEnumerator json_files( external_extension_search_path, false, // Recursive. - file_util::FileEnumerator::FILES); + base::FileEnumerator::FILES); #if defined(OS_WIN) base::FilePath::StringType extension = UTF8ToWide(std::string(".json")); #elif defined(OS_POSIX) diff --git a/chrome/browser/extensions/sandboxed_unpacker_unittest.cc b/chrome/browser/extensions/sandboxed_unpacker_unittest.cc index 4a97f57..5b8dcdd 100644 --- a/chrome/browser/extensions/sandboxed_unpacker_unittest.cc +++ b/chrome/browser/extensions/sandboxed_unpacker_unittest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/files/scoped_temp_dir.h" #include "base/memory/ref_counted.h" #include "base/message_loop.h" @@ -132,10 +133,10 @@ class SandboxedUnpackerTest : public testing::Test { bool TempFilesRemoved() { // Check that temporary files were cleaned up. - int files_and_dirs = file_util::FileEnumerator::DIRECTORIES | - file_util::FileEnumerator::FILES; + int files_and_dirs = base::FileEnumerator::DIRECTORIES | + base::FileEnumerator::FILES; - file_util::FileEnumerator temp_iterator( + base::FileEnumerator temp_iterator( temp_path_, true, // recursive files_and_dirs diff --git a/chrome/browser/file_select_helper.cc b/chrome/browser/file_select_helper.cc index 0b6746c..87c1499 100644 --- a/chrome/browser/file_select_helper.cc +++ b/chrome/browser/file_select_helper.cc @@ -8,6 +8,7 @@ #include "base/bind.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/platform_file.h" #include "base/string_util.h" #include "base/strings/string_split.h" @@ -219,7 +220,7 @@ void FileSelectHelper::OnListFile( // Directory upload returns directories via a "." file, so that // empty directories are included. This util call just checks // the flags in the structure; there's no file I/O going on. - if (file_util::FileEnumerator::IsDirectory(data.info)) + if (data.info.IsDirectory()) entry->results_.push_back(data.path.Append(FILE_PATH_LITERAL("."))); else entry->results_.push_back(data.path); diff --git a/chrome/browser/history/expire_history_backend.cc b/chrome/browser/history/expire_history_backend.cc index 797cb93..6652aca 100644 --- a/chrome/browser/history/expire_history_backend.cc +++ b/chrome/browser/history/expire_history_backend.cc @@ -11,6 +11,7 @@ #include "base/bind.h" #include "base/compiler_specific.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/logging.h" #include "base/message_loop.h" #include "chrome/browser/bookmarks/bookmark_service.h" @@ -754,8 +755,8 @@ void ExpireHistoryBackend::DoExpireHistoryIndexFiles() { base::FilePath::StringType history_index_files_pattern = TextDatabase::file_base(); history_index_files_pattern.append(FILE_PATH_LITERAL("*")); - file_util::FileEnumerator file_enumerator( - text_db_->GetDir(), false, file_util::FileEnumerator::FILES, + base::FileEnumerator file_enumerator( + text_db_->GetDir(), false, base::FileEnumerator::FILES, history_index_files_pattern); for (base::FilePath file = file_enumerator.Next(); !file.empty(); file = file_enumerator.Next()) { diff --git a/chrome/browser/history/text_database_manager.cc b/chrome/browser/history/text_database_manager.cc index 6f1b845..f518adb 100644 --- a/chrome/browser/history/text_database_manager.cc +++ b/chrome/browser/history/text_database_manager.cc @@ -10,6 +10,7 @@ #include "base/bind.h" #include "base/compiler_specific.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/logging.h" #include "base/message_loop.h" #include "base/metrics/histogram.h" @@ -160,8 +161,8 @@ void TextDatabaseManager::InitDBList() { // Find files on disk matching our pattern so we can quickly test for them. base::FilePath::StringType filepattern(TextDatabase::file_base()); filepattern.append(FILE_PATH_LITERAL("*")); - file_util::FileEnumerator enumerator( - dir_, false, file_util::FileEnumerator::FILES, filepattern); + base::FileEnumerator enumerator( + dir_, false, base::FileEnumerator::FILES, filepattern); base::FilePath cur_file; while (!(cur_file = enumerator.Next()).empty()) { // Convert to the number representing this file. diff --git a/chrome/browser/importer/firefox3_importer.cc b/chrome/browser/importer/firefox3_importer.cc index d890f08..953c075 100644 --- a/chrome/browser/importer/firefox3_importer.cc +++ b/chrome/browser/importer/firefox3_importer.cc @@ -7,6 +7,7 @@ #include <set> #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" #include "base/stl_util.h" @@ -453,8 +454,7 @@ void Firefox3Importer::GetSearchEnginesXMLFiles( #endif // Get search engine definition from file system. - file_util::FileEnumerator engines(app_path, false, - file_util::FileEnumerator::FILES); + base::FileEnumerator engines(app_path, false, base::FileEnumerator::FILES); for (base::FilePath engine_path = engines.Next(); !engine_path.value().empty(); engine_path = engines.Next()) { files->push_back(engine_path); diff --git a/chrome/browser/importer/ie_importer.cc b/chrome/browser/importer/ie_importer.cc index 572ca90..d7c632c 100644 --- a/chrome/browser/importer/ie_importer.cc +++ b/chrome/browser/importer/ie_importer.cc @@ -16,6 +16,7 @@ #include <vector> #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/files/file_path.h" #include "base/string16.h" #include "base/string_util.h" @@ -809,8 +810,8 @@ void IEImporter::ParseFavoritesFolder( // Favorites path length. Make sure it doesn't include the trailing \. size_t favorites_path_len = favorites_path.StripTrailingSeparators().value().size(); - file_util::FileEnumerator file_enumerator( - favorites_path, true, file_util::FileEnumerator::FILES); + base::FileEnumerator file_enumerator( + favorites_path, true, base::FileEnumerator::FILES); while (!(file = file_enumerator.Next()).value().empty() && !cancelled()) file_list.push_back(file.value()); diff --git a/chrome/browser/media_galleries/fileapi/native_media_file_util.cc b/chrome/browser/media_galleries/fileapi/native_media_file_util.cc index 503fdbb..45a5c1d 100644 --- a/chrome/browser/media_galleries/fileapi/native_media_file_util.cc +++ b/chrome/browser/media_galleries/fileapi/native_media_file_util.cc @@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/string_util.h" #include "base/task_runner_util.h" #include "chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.h" @@ -531,16 +532,10 @@ base::PlatformFileError NativeMediaFileUtil::ReadDirectorySync( if (!file_info.is_directory) return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY; - file_util::FileEnumerator file_enum( + base::FileEnumerator file_enum( platform_path, false /* recursive */, - file_util::FileEnumerator::FILES | - file_util::FileEnumerator::DIRECTORIES); - file_util::FileEnumerator::FindInfo file_util_info; -#if defined(OS_WIN) - memset(&file_util_info, 0, sizeof(file_util_info)); -#endif // defined(OS_WIN) - + base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES); for (base::FilePath platform_path = file_enum.Next(); !platform_path.empty(); platform_path = file_enum.Next()) { @@ -548,21 +543,20 @@ base::PlatformFileError NativeMediaFileUtil::ReadDirectorySync( if (file_util::IsLink(platform_path)) continue; - file_enum.GetFindInfo(&file_util_info); + base::FileEnumerator::FileInfo info = file_enum.GetInfo(); // NativeMediaFileUtil skip criteria. if (ShouldSkip(platform_path)) continue; - if (!file_util::FileEnumerator::IsDirectory(file_util_info) && + if (!info.IsDirectory() && !GetMediaPathFilter(context)->Match(platform_path)) continue; fileapi::DirectoryEntry entry; - entry.is_directory = file_util::FileEnumerator::IsDirectory(file_util_info); + entry.is_directory = info.IsDirectory(); entry.name = platform_path.BaseName().value(); - entry.size = file_util::FileEnumerator::GetFilesize(file_util_info); - entry.last_modified_time = - file_util::FileEnumerator::GetLastModifiedTime(file_util_info); + entry.size = info.GetSize(); + entry.last_modified_time = info.GetLastModifiedTime(); file_list->push_back(entry); } diff --git a/chrome/browser/policy/config_dir_policy_loader.cc b/chrome/browser/policy/config_dir_policy_loader.cc index 572a82d..56b079d 100644 --- a/chrome/browser/policy/config_dir_policy_loader.cc +++ b/chrome/browser/policy/config_dir_policy_loader.cc @@ -11,6 +11,7 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/json/json_file_value_serializer.h" #include "base/json/json_reader.h" #include "base/logging.h" @@ -100,8 +101,8 @@ base::Time ConfigDirPolicyLoader::LastModificationTime() { continue; // Enumerate the files and find the most recent modification timestamp. - file_util::FileEnumerator file_enumerator(path, false, - file_util::FileEnumerator::FILES); + base::FileEnumerator file_enumerator(path, false, + base::FileEnumerator::FILES); for (base::FilePath config_file = file_enumerator.Next(); !config_file.empty(); config_file = file_enumerator.Next()) { @@ -118,8 +119,8 @@ void ConfigDirPolicyLoader::LoadFromPath(const base::FilePath& path, PolicyBundle* bundle) { // Enumerate the files and sort them lexicographically. std::set<base::FilePath> files; - file_util::FileEnumerator file_enumerator(path, false, - file_util::FileEnumerator::FILES); + base::FileEnumerator file_enumerator(path, false, + base::FileEnumerator::FILES); for (base::FilePath config_file_path = file_enumerator.Next(); !config_file_path.empty(); config_file_path = file_enumerator.Next()) files.insert(config_file_path); diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc index 8a54906..24b917d 100644 --- a/chrome/browser/policy/policy_browsertest.cc +++ b/chrome/browser/policy/policy_browsertest.cc @@ -10,6 +10,7 @@ #include "base/bind_helpers.h" #include "base/command_line.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/files/file_path.h" #include "base/files/scoped_temp_dir.h" #include "base/memory/ref_counted.h" @@ -290,8 +291,7 @@ void DownloadAndVerifyFile( EXPECT_EQ( 1u, observer.NumDownloadsSeenInState(content::DownloadItem::COMPLETE)); EXPECT_TRUE(file_util::PathExists(downloaded)); - file_util::FileEnumerator enumerator( - dir, false, file_util::FileEnumerator::FILES); + base::FileEnumerator enumerator(dir, false, base::FileEnumerator::FILES); EXPECT_EQ(file, enumerator.Next().BaseName()); EXPECT_EQ(base::FilePath(), enumerator.Next()); } @@ -300,9 +300,9 @@ void DownloadAndVerifyFile( int CountScreenshots() { DownloadPrefs* download_prefs = DownloadPrefs::FromBrowserContext( ash::Shell::GetInstance()->delegate()->GetCurrentBrowserContext()); - file_util::FileEnumerator enumerator(download_prefs->DownloadPath(), - false, file_util::FileEnumerator::FILES, - "Screenshot*"); + base::FileEnumerator enumerator(download_prefs->DownloadPath(), + false, base::FileEnumerator::FILES, + "Screenshot*"); int count = 0; while (!enumerator.Next().empty()) count++; diff --git a/chrome/browser/printing/printing_layout_browsertest.cc b/chrome/browser/printing/printing_layout_browsertest.cc index d64186d..97803fd 100644 --- a/chrome/browser/printing/printing_layout_browsertest.cc +++ b/chrome/browser/printing/printing_layout_browsertest.cc @@ -4,6 +4,7 @@ #include "base/command_line.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/files/file_path.h" #include "base/message_loop.h" #include "base/path_service.h" @@ -197,8 +198,8 @@ class PrintingLayoutTest : public PrintingTest<InProcessBrowserTest>, bool found_emf = false; bool found_prn = false; for (int i = 0; i < 100; ++i) { - file_util::FileEnumerator enumerator(emf_path_, false, - file_util::FileEnumerator::FILES); + base::FileEnumerator enumerator(emf_path_, false, + base::FileEnumerator::FILES); emf_file.clear(); prn_file.clear(); found_emf = false; diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc index 43f008c..8b57d6e 100644 --- a/chrome/browser/profiles/profile_manager.cc +++ b/chrome/browser/profiles/profile_manager.cc @@ -11,6 +11,7 @@ #include "base/debug/trace_event.h" #include "base/deferred_sequenced_task_runner.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/files/file_path.h" #include "base/metrics/histogram.h" #include "base/prefs/pref_registry_simple.h" @@ -96,14 +97,10 @@ std::vector<base::FilePath>& ProfilesToDelete() { int64 ComputeFilesSize(const base::FilePath& directory, const base::FilePath::StringType& pattern) { int64 running_size = 0; - file_util::FileEnumerator iter(directory, false, - file_util::FileEnumerator::FILES, - pattern); - while (!iter.Next().empty()) { - file_util::FileEnumerator::FindInfo info; - iter.GetFindInfo(&info); - running_size += file_util::FileEnumerator::GetFilesize(info); - } + base::FileEnumerator iter(directory, false, base::FileEnumerator::FILES, + pattern); + while (!iter.Next().empty()) + running_size += iter.GetInfo().GetSize(); return running_size; } diff --git a/chrome/browser/profiles/profile_shortcut_manager_win.cc b/chrome/browser/profiles/profile_shortcut_manager_win.cc index 726fb3c..1302dbc 100644 --- a/chrome/browser/profiles/profile_shortcut_manager_win.cc +++ b/chrome/browser/profiles/profile_shortcut_manager_win.cc @@ -12,6 +12,7 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/path_service.h" #include "base/string16.h" #include "base/string_util.h" @@ -233,8 +234,8 @@ void ListDesktopShortcutsWithCommandLine(const base::FilePath& chrome_exe, if (!GetDesktopShortcutsDirectories(&user_shortcuts_directory, NULL)) return; - file_util::FileEnumerator enumerator(user_shortcuts_directory, false, - file_util::FileEnumerator::FILES); + base::FileEnumerator enumerator(user_shortcuts_directory, false, + base::FileEnumerator::FILES); for (base::FilePath path = enumerator.Next(); !path.empty(); path = enumerator.Next()) { string16 shortcut_command_line; @@ -403,8 +404,8 @@ bool ChromeDesktopShortcutsExist(const base::FilePath& chrome_exe) { if (!GetDesktopShortcutsDirectories(&user_shortcuts_directory, NULL)) return false; - file_util::FileEnumerator enumerator(user_shortcuts_directory, false, - file_util::FileEnumerator::FILES); + base::FileEnumerator enumerator(user_shortcuts_directory, false, + base::FileEnumerator::FILES); for (base::FilePath path = enumerator.Next(); !path.empty(); path = enumerator.Next()) { if (IsChromeShortcut(path, chrome_exe, NULL)) diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc index 8501c30..79cf9a5 100644 --- a/chrome/browser/shell_integration_win.cc +++ b/chrome/browser/shell_integration_win.cc @@ -11,6 +11,7 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/message_loop.h" #include "base/path_service.h" #include "base/string_util.h" @@ -392,9 +393,9 @@ int ShellIntegration::MigrateShortcutsInPathInternal( DCHECK(base::win::GetVersion() >= base::win::VERSION_WIN7); // Enumerate all pinned shortcuts in the given path directly. - file_util::FileEnumerator shortcuts_enum( + base::FileEnumerator shortcuts_enum( path, false, // not recursive - file_util::FileEnumerator::FILES, FILE_PATH_LITERAL("*.lnk")); + base::FileEnumerator::FILES, FILE_PATH_LITERAL("*.lnk")); bool is_per_user_install = InstallUtil::IsPerUserInstall(chrome_exe.value().c_str()); diff --git a/chrome/browser/ui/pdf/pdf_browsertest.cc b/chrome/browser/ui/pdf/pdf_browsertest.cc index 4d6e115..91195d4 100644 --- a/chrome/browser/ui/pdf/pdf_browsertest.cc +++ b/chrome/browser/ui/pdf/pdf_browsertest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/hash.h" #include "base/path_service.h" #include "base/string_util.h" @@ -312,10 +313,10 @@ IN_PROC_BROWSER_TEST_P(PDFBrowserTest, Loading) { content::Source<NavigationController>(controller)); std::string base_url = std::string("files/"); - file_util::FileEnumerator file_enumerator( + base::FileEnumerator file_enumerator( ui_test_utils::GetTestFilePath(GetPDFTestDir(), base::FilePath()), false, - file_util::FileEnumerator::FILES, + base::FileEnumerator::FILES, FILE_PATH_LITERAL("*.pdf")); for (base::FilePath file_path = file_enumerator.Next(); !file_path.empty(); diff --git a/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc b/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc index 201ea9b..c8ee2c5 100644 --- a/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc +++ b/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc @@ -7,6 +7,7 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/format_macros.h" #include "base/memory/scoped_vector.h" #include "base/memory/weak_ptr.h" @@ -65,26 +66,22 @@ void GetGCacheContents(const base::FilePath& root_path, DCHECK(gcache_contents); DCHECK(gcache_summary); - using file_util::FileEnumerator; // Use this map to sort the result list by the path. std::map<base::FilePath, DictionaryValue*> files; - const int options = (file_util::FileEnumerator::FILES | - file_util::FileEnumerator::DIRECTORIES | - file_util::FileEnumerator::SHOW_SYM_LINKS); - FileEnumerator enumerator(root_path, true /* recursive */, options); + const int options = (base::FileEnumerator::FILES | + base::FileEnumerator::DIRECTORIES | + base::FileEnumerator::SHOW_SYM_LINKS); + base::FileEnumerator enumerator(root_path, true /* recursive */, options); int64 total_size = 0; for (base::FilePath current = enumerator.Next(); !current.empty(); current = enumerator.Next()) { - FileEnumerator::FindInfo find_info; - enumerator.GetFindInfo(&find_info); - int64 size = FileEnumerator::GetFilesize(find_info); - const bool is_directory = FileEnumerator::IsDirectory(find_info); - const bool is_symbolic_link = - file_util::IsLink(FileEnumerator::GetFilename(find_info)); - const base::Time last_modified = - FileEnumerator::GetLastModifiedTime(find_info); + base::FileEnumerator::FileInfo info = enumerator.GetInfo(); + int64 size = info.GetSize(); + const bool is_directory = info.IsDirectory(); + const bool is_symbolic_link = file_util::IsLink(info.GetName()); + const base::Time last_modified = info.GetLastModifiedTime(); base::DictionaryValue* entry = new base::DictionaryValue; entry->SetString("path", current.value()); @@ -98,7 +95,7 @@ void GetGCacheContents(const base::FilePath& root_path, // Print lower 9 bits in octal format. entry->SetString( "permission", - base::StringPrintf("%03o", find_info.stat.st_mode & 0x1ff)); + base::StringPrintf("%03o", info.stat().st_mode & 0x1ff)); files[current] = entry; total_size += size; diff --git a/chrome/browser/ui/webui/feedback_ui.cc b/chrome/browser/ui/webui/feedback_ui.cc index 0962d94..cd9b083 100644 --- a/chrome/browser/ui/webui/feedback_ui.cc +++ b/chrome/browser/ui/webui/feedback_ui.cc @@ -10,6 +10,7 @@ #include "base/base64.h" #include "base/bind.h" #include "base/bind_helpers.h" +#include "base/files/file_enumerator.h" #include "base/logging.h" #include "base/memory/weak_ptr.h" #include "base/message_loop.h" @@ -704,9 +705,8 @@ void FeedbackUI::GetMostRecentScreenshots( std::string pattern = std::string(ScreenshotSource::kScreenshotPrefix) + "*" + ScreenshotSource::kScreenshotSuffix; - file_util::FileEnumerator screenshots(filepath, false, - file_util::FileEnumerator::FILES, - pattern); + base::FileEnumerator screenshots(filepath, false, + base::FileEnumerator::FILES, pattern); base::FilePath screenshot = screenshots.Next(); std::vector<std::string> screenshot_filepaths; diff --git a/chrome/browser/web_applications/web_app_mac.mm b/chrome/browser/web_applications/web_app_mac.mm index 814a441..0439b32 100644 --- a/chrome/browser/web_applications/web_app_mac.mm +++ b/chrome/browser/web_applications/web_app_mac.mm @@ -9,6 +9,7 @@ #include "base/command_line.h" #include "base/file_util.h" +#include "base/files/file_enumerator.h" #include "base/files/scoped_temp_dir.h" #include "base/mac/bundle_locations.h" #include "base/mac/foundation_util.h" @@ -142,9 +143,9 @@ bool HasExistingExtensionShim(const base::FilePath& destination_directory, const std::string& extension_id, const base::FilePath& own_basename) { // Check if there any any other shims for the same extension. - file_util::FileEnumerator enumerator(destination_directory, - false /* recursive */, - file_util::FileEnumerator::DIRECTORIES); + base::FileEnumerator enumerator(destination_directory, + false /* recursive */, + base::FileEnumerator::DIRECTORIES); for (base::FilePath shim_path = enumerator.Next(); !shim_path.empty(); shim_path = enumerator.Next()) { if (shim_path.BaseName() != own_basename && |