#include "chrome/browser/sync_file_system/local/syncable_file_system_operation.h"
#include <utility>
#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/notreached.h"
#include "chrome/browser/sync_file_system/local/local_file_sync_context.h"
#include "chrome/browser/sync_file_system/local/sync_file_system_backend.h"
#include "chrome/browser/sync_file_system/local/syncable_file_operation_runner.h"
#include "chrome/browser/sync_file_system/syncable_file_system_util.h"
#include "content/public/browser/browser_thread.h"
#include "storage/browser/blob/shareable_file_reference.h"
#include "storage/browser/file_system/copy_or_move_hook_delegate.h"
#include "storage/browser/file_system/file_system_context.h"
#include "storage/browser/file_system/file_system_operation.h"
#include "storage/browser/file_system/file_system_operation_context.h"
#include "storage/browser/file_system/file_system_url.h"
#include "storage/browser/file_system/file_writer_delegate.h"
FileSystemURL;
namespace sync_file_system {
namespace {
void WriteCallbackAdapter(
const SyncableFileSystemOperation::WriteCallback& callback,
base::File::Error status) { … }
}
class SyncableFileSystemOperation::QueueableTask
: public SyncableFileOperationRunner::Task { … };
SyncableFileSystemOperation::~SyncableFileSystemOperation() { … }
void SyncableFileSystemOperation::CreateFile(const FileSystemURL& url,
bool exclusive,
StatusCallback callback) { … }
void SyncableFileSystemOperation::CreateDirectory(const FileSystemURL& url,
bool exclusive,
bool recursive,
StatusCallback callback) { … }
void SyncableFileSystemOperation::Copy(
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
CopyOrMoveOptionSet options,
ErrorBehavior error_behavior,
std::unique_ptr<storage::CopyOrMoveHookDelegate> copy_or_move_hook_delegate,
StatusCallback callback) { … }
void SyncableFileSystemOperation::Move(
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
CopyOrMoveOptionSet options,
ErrorBehavior error_behavior,
std::unique_ptr<storage::CopyOrMoveHookDelegate> copy_or_move_hook_delegate,
StatusCallback callback) { … }
void SyncableFileSystemOperation::DirectoryExists(const FileSystemURL& url,
StatusCallback callback) { … }
void SyncableFileSystemOperation::FileExists(const FileSystemURL& url,
StatusCallback callback) { … }
void SyncableFileSystemOperation::GetMetadata(const FileSystemURL& url,
GetMetadataFieldSet fields,
GetMetadataCallback callback) { … }
void SyncableFileSystemOperation::ReadDirectory(
const FileSystemURL& url,
const ReadDirectoryCallback& callback) { … }
void SyncableFileSystemOperation::Remove(const FileSystemURL& url,
bool recursive,
StatusCallback callback) { … }
void SyncableFileSystemOperation::WriteBlob(
const FileSystemURL& url,
std::unique_ptr<storage::FileWriterDelegate> writer_delegate,
std::unique_ptr<storage::BlobReader> blob_reader,
const WriteCallback& callback) { … }
void SyncableFileSystemOperation::Write(
const FileSystemURL& url,
std::unique_ptr<storage::FileWriterDelegate> writer_delegate,
mojo::ScopedDataPipeConsumerHandle data_pipe,
const WriteCallback& callback) { … }
void SyncableFileSystemOperation::Truncate(const FileSystemURL& url,
int64_t length,
StatusCallback callback) { … }
void SyncableFileSystemOperation::TouchFile(
const FileSystemURL& url,
const base::Time& last_access_time,
const base::Time& last_modified_time,
StatusCallback callback) { … }
void SyncableFileSystemOperation::OpenFile(const FileSystemURL& url,
uint32_t file_flags,
OpenFileCallback callback) { … }
void SyncableFileSystemOperation::Cancel(StatusCallback cancel_callback) { … }
void SyncableFileSystemOperation::CreateSnapshotFile(
const FileSystemURL& path,
SnapshotFileCallback callback) { … }
void SyncableFileSystemOperation::CopyInForeignFile(
const base::FilePath& src_local_disk_path,
const FileSystemURL& dest_url,
StatusCallback callback) { … }
void SyncableFileSystemOperation::RemoveFile(const FileSystemURL& url,
StatusCallback callback) { … }
void SyncableFileSystemOperation::RemoveDirectory(const FileSystemURL& url,
StatusCallback callback) { … }
void SyncableFileSystemOperation::CopyFileLocal(
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
CopyOrMoveOptionSet options,
const CopyFileProgressCallback& progress_callback,
StatusCallback callback) { … }
void SyncableFileSystemOperation::MoveFileLocal(const FileSystemURL& src_url,
const FileSystemURL& dest_url,
CopyOrMoveOptionSet options,
StatusCallback callback) { … }
base::File::Error SyncableFileSystemOperation::SyncGetPlatformPath(
const FileSystemURL& url,
base::FilePath* platform_path) { … }
SyncableFileSystemOperation::SyncableFileSystemOperation(
storage::OperationType type,
const FileSystemURL& url,
storage::FileSystemContext* file_system_context,
std::unique_ptr<storage::FileSystemOperationContext> operation_context,
base::PassKey<SyncFileSystemBackend>)
: … { … }
void SyncableFileSystemOperation::DidFinish(base::File::Error status) { … }
void SyncableFileSystemOperation::DidWrite(const WriteCallback& callback,
base::File::Error result,
int64_t bytes,
bool complete) { … }
void SyncableFileSystemOperation::OnCancelled() { … }
}