#include "storage/browser/file_system/isolated_context.h"
#include <stddef.h>
#include <stdint.h>
#include <memory>
#include "base/check_op.h"
#include "base/containers/contains.h"
#include "base/not_fatal_until.h"
#include "base/notreached.h"
#include "base/rand_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "storage/browser/file_system/file_system_url.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
class GURL;
namespace storage {
namespace {
base::FilePath::StringType GetRegisterNameForPath(const base::FilePath& path) { … }
bool IsSinglePathIsolatedFileSystem(FileSystemType type) { … }
static base::LazyInstance<IsolatedContext>::Leaky g_isolated_context = …;
}
IsolatedContext::FileInfoSet::FileInfoSet() = default;
IsolatedContext::FileInfoSet::~FileInfoSet() = default;
bool IsolatedContext::FileInfoSet::AddPath(const base::FilePath& path,
std::string* registered_name) { … }
bool IsolatedContext::FileInfoSet::AddPathWithName(const base::FilePath& path,
const std::string& name) { … }
IsolatedContext::ScopedFSHandle::ScopedFSHandle(std::string file_system_id)
: … { … }
IsolatedContext::ScopedFSHandle::~ScopedFSHandle() { … }
IsolatedContext::ScopedFSHandle::ScopedFSHandle(const ScopedFSHandle& other)
: … { … }
IsolatedContext::ScopedFSHandle::ScopedFSHandle(ScopedFSHandle&& other)
: … { … }
IsolatedContext::ScopedFSHandle& IsolatedContext::ScopedFSHandle::operator=(
const ScopedFSHandle& other) { … }
IsolatedContext::ScopedFSHandle& IsolatedContext::ScopedFSHandle::operator=(
ScopedFSHandle&& other) { … }
class IsolatedContext::Instance { … };
IsolatedContext::Instance::Instance(FileSystemType type,
const std::string& filesystem_id,
const MountPointInfo& file_info,
Instance::PathType path_type)
: … { … }
IsolatedContext::Instance::Instance(FileSystemType type,
const std::set<MountPointInfo>& files)
: … { … }
IsolatedContext::Instance::~Instance() = default;
bool IsolatedContext::Instance::ResolvePathForName(const std::string& name,
base::FilePath* path) const { … }
bool IsolatedContext::Instance::IsSinglePathInstance() const { … }
IsolatedContext* IsolatedContext::GetInstance() { … }
bool IsolatedContext::IsIsolatedType(FileSystemType type) { … }
std::string IsolatedContext::RegisterDraggedFileSystem(
const FileInfoSet& files) { … }
IsolatedContext::ScopedFSHandle IsolatedContext::RegisterFileSystemForPath(
FileSystemType type,
const std::string& filesystem_id,
const base::FilePath& path_in,
std::string* register_name) { … }
std::string IsolatedContext::RegisterFileSystemForVirtualPath(
FileSystemType type,
const std::string& register_name,
const base::FilePath& cracked_path_prefix) { … }
bool IsolatedContext::HandlesFileSystemMountType(FileSystemType type) const { … }
bool IsolatedContext::RevokeFileSystem(const std::string& filesystem_id) { … }
bool IsolatedContext::GetRegisteredPath(const std::string& filesystem_id,
base::FilePath* path) const { … }
bool IsolatedContext::CrackVirtualPath(
const base::FilePath& virtual_path,
std::string* id_or_name,
FileSystemType* type,
std::string* cracked_id,
base::FilePath* path,
FileSystemMountOption* mount_option) const { … }
FileSystemURL IsolatedContext::CrackURL(
const GURL& url,
const blink::StorageKey& storage_key) const { … }
FileSystemURL IsolatedContext::CreateCrackedFileSystemURL(
const blink::StorageKey& storage_key,
FileSystemType type,
const base::FilePath& virtual_path) const { … }
void IsolatedContext::RevokeFileSystemByPath(const base::FilePath& path_in) { … }
void IsolatedContext::AddReference(const std::string& filesystem_id) { … }
void IsolatedContext::RemoveReference(const std::string& filesystem_id) { … }
bool IsolatedContext::GetDraggedFileInfo(
const std::string& filesystem_id,
std::vector<MountPointInfo>* files) const { … }
base::FilePath IsolatedContext::CreateVirtualRootPath(
const std::string& filesystem_id) const { … }
IsolatedContext::IsolatedContext() = default;
IsolatedContext::~IsolatedContext() = default;
FileSystemURL IsolatedContext::CrackFileSystemURL(
const FileSystemURL& url) const { … }
bool IsolatedContext::UnregisterFileSystem(const std::string& filesystem_id) { … }
std::string IsolatedContext::GetNewFileSystemId() const { … }
}