#include "storage/browser/file_system/async_file_util_adapter.h"
#include <stddef.h>
#include <stdint.h>
#include <memory>
#include <utility>
#include <vector>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "components/services/filesystem/public/mojom/types.mojom.h"
#include "storage/browser/blob/shareable_file_reference.h"
#include "storage/browser/file_system/file_system_context.h"
#include "storage/browser/file_system/file_system_file_util.h"
#include "storage/browser/file_system/file_system_operation_context.h"
#include "storage/browser/file_system/file_system_url.h"
#include "storage/common/file_system/file_system_util.h"
Unretained;
namespace storage {
namespace {
class EnsureFileExistsHelper { … };
class GetFileInfoHelper { … };
void ReadDirectoryHelper(FileSystemFileUtil* file_util,
FileSystemOperationContext* context,
const FileSystemURL& url,
base::SingleThreadTaskRunner* origin_runner,
AsyncFileUtil::ReadDirectoryCallback callback) { … }
void RunCreateOrOpenCallback(FileSystemOperationContext* context,
AsyncFileUtil::CreateOrOpenCallback callback,
base::File file) { … }
}
AsyncFileUtilAdapter::AsyncFileUtilAdapter(
std::unique_ptr<FileSystemFileUtil> sync_file_util)
: … { … }
AsyncFileUtilAdapter::~AsyncFileUtilAdapter() = default;
void AsyncFileUtilAdapter::CreateOrOpen(
std::unique_ptr<FileSystemOperationContext> context,
const FileSystemURL& url,
uint32_t file_flags,
CreateOrOpenCallback callback) { … }
void AsyncFileUtilAdapter::EnsureFileExists(
std::unique_ptr<FileSystemOperationContext> context,
const FileSystemURL& url,
EnsureFileExistsCallback callback) { … }
void AsyncFileUtilAdapter::CreateDirectory(
std::unique_ptr<FileSystemOperationContext> context,
const FileSystemURL& url,
bool exclusive,
bool recursive,
StatusCallback callback) { … }
void AsyncFileUtilAdapter::GetFileInfo(
std::unique_ptr<FileSystemOperationContext> context,
const FileSystemURL& url,
GetMetadataFieldSet fields,
GetFileInfoCallback callback) { … }
void AsyncFileUtilAdapter::ReadDirectory(
std::unique_ptr<FileSystemOperationContext> context,
const FileSystemURL& url,
ReadDirectoryCallback callback) { … }
void AsyncFileUtilAdapter::Touch(
std::unique_ptr<FileSystemOperationContext> context,
const FileSystemURL& url,
const base::Time& last_access_time,
const base::Time& last_modified_time,
StatusCallback callback) { … }
void AsyncFileUtilAdapter::Truncate(
std::unique_ptr<FileSystemOperationContext> context,
const FileSystemURL& url,
int64_t length,
StatusCallback callback) { … }
void AsyncFileUtilAdapter::CopyFileLocal(
std::unique_ptr<FileSystemOperationContext> context,
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
CopyOrMoveOptionSet options,
CopyFileProgressCallback progress_callback,
StatusCallback callback) { … }
void AsyncFileUtilAdapter::MoveFileLocal(
std::unique_ptr<FileSystemOperationContext> context,
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
CopyOrMoveOptionSet options,
StatusCallback callback) { … }
void AsyncFileUtilAdapter::CopyInForeignFile(
std::unique_ptr<FileSystemOperationContext> context,
const base::FilePath& src_file_path,
const FileSystemURL& dest_url,
StatusCallback callback) { … }
void AsyncFileUtilAdapter::DeleteFile(
std::unique_ptr<FileSystemOperationContext> context,
const FileSystemURL& url,
StatusCallback callback) { … }
void AsyncFileUtilAdapter::DeleteDirectory(
std::unique_ptr<FileSystemOperationContext> context,
const FileSystemURL& url,
StatusCallback callback) { … }
void AsyncFileUtilAdapter::DeleteRecursively(
std::unique_ptr<FileSystemOperationContext> context,
const FileSystemURL& url,
StatusCallback callback) { … }
void AsyncFileUtilAdapter::CreateSnapshotFile(
std::unique_ptr<FileSystemOperationContext> context,
const FileSystemURL& url,
CreateSnapshotFileCallback callback) { … }
}