#include "components/services/storage/public/cpp/filesystem/filesystem_impl.h"
#include <set>
#include <vector>
#include "base/check.h"
#include "base/containers/contains.h"
#include "base/files/file.h"
#include "base/files/file_enumerator.h"
#include "base/files/file_util.h"
#include "base/files/important_file_writer.h"
#include "base/no_destructor.h"
#include "base/notreached.h"
#include "base/synchronization/lock.h"
#include "base/types/expected_macros.h"
#include "build/build_config.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#if BUILDFLAG(IS_WIN)
#include <windows.h>
#endif
namespace storage {
namespace {
class LockTable { … };
LockTable& GetLockTable() { … }
class FileLockImpl : public mojom::FileLock { … };
}
FilesystemImpl::FilesystemImpl(const base::FilePath& root,
ClientType client_type)
: … { … }
FilesystemImpl::~FilesystemImpl() = default;
void FilesystemImpl::Clone(mojo::PendingReceiver<mojom::Directory> receiver) { … }
void FilesystemImpl::PathExists(const base::FilePath& path,
PathExistsCallback callback) { … }
void FilesystemImpl::GetEntries(const base::FilePath& path,
mojom::GetEntriesMode mode,
GetEntriesCallback callback) { … }
void FilesystemImpl::OpenFile(const base::FilePath& path,
mojom::FileOpenMode mode,
mojom::FileReadAccess read_access,
mojom::FileWriteAccess write_access,
OpenFileCallback callback) { … }
void FilesystemImpl::CreateDirectory(const base::FilePath& path,
CreateDirectoryCallback callback) { … }
void FilesystemImpl::DeleteFile(const base::FilePath& path,
DeleteFileCallback callback) { … }
void FilesystemImpl::GetFileInfo(const base::FilePath& path,
GetFileInfoCallback callback) { … }
void FilesystemImpl::GetPathAccess(const base::FilePath& path,
GetPathAccessCallback callback) { … }
void FilesystemImpl::RenameFile(const base::FilePath& old_path,
const base::FilePath& new_path,
RenameFileCallback callback) { … }
void FilesystemImpl::LockFile(const base::FilePath& path,
LockFileCallback callback) { … }
base::FileErrorOr<base::File> FilesystemImpl::LockFileLocal(
const base::FilePath& path,
bool* same_process_failure) { … }
void FilesystemImpl::UnlockFileLocal(const base::FilePath& path) { … }
mojom::PathAccessInfoPtr FilesystemImpl::GetPathAccessLocal(
const base::FilePath& path) { … }
base::FileErrorOr<std::vector<base::FilePath>>
FilesystemImpl::GetDirectoryEntries(const base::FilePath& path,
mojom::GetEntriesMode mode) { … }
base::FilePath FilesystemImpl::MakeAbsolute(const base::FilePath& path) const { … }
}