#include "components/download/internal/background_service/file_monitor_impl.h"
#include "base/debug/alias.h"
#include "base/files/file_enumerator.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/stl_util.h"
#include "base/task/sequenced_task_runner.h"
#include "base/threading/scoped_blocking_call.h"
#include "build/build_config.h"
#if BUILDFLAG(IS_CHROMEOS)
#include <grp.h>
#endif
namespace download {
namespace {
bool InitializeAndCreateDownloadDirectory(const base::FilePath& dir_path) { … }
void GetFilesInDirectory(const base::FilePath& directory,
std::set<base::FilePath>& paths_out) { … }
void DeleteFilesOnFileThread(const std::set<base::FilePath>& paths,
stats::FileCleanupReason reason) { … }
void DeleteUnknownFilesOnFileThread(
const base::FilePath& directory,
const std::set<base::FilePath>& download_file_paths) { … }
bool HardRecoverOnFileThread(const base::FilePath& directory) { … }
}
FileMonitorImpl::FileMonitorImpl(
const base::FilePath& download_file_dir,
const scoped_refptr<base::SequencedTaskRunner>& file_thread_task_runner)
: … { … }
FileMonitorImpl::~FileMonitorImpl() = default;
void FileMonitorImpl::Initialize(InitCallback callback) { … }
void FileMonitorImpl::DeleteUnknownFiles(
const Model::EntryList& known_entries,
const std::vector<DriverEntry>& known_driver_entries,
base::OnceClosure completion_callback) { … }
void FileMonitorImpl::CleanupFilesForCompletedEntries(
const Model::EntryList& entries,
base::OnceClosure completion_callback) { … }
void FileMonitorImpl::DeleteFiles(
const std::set<base::FilePath>& files_to_remove,
stats::FileCleanupReason reason) { … }
void FileMonitorImpl::HardRecover(InitCallback callback) { … }
}