#include "content/browser/blob_storage/chrome_blob_storage_context.h"
#include <memory>
#include <utility>
#include "base/feature_list.h"
#include "base/files/file.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/supports_user_data.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/task_runner.h"
#include "base/task/thread_pool.h"
#include "base/uuid.h"
#include "components/file_access/scoped_file_access_delegate.h"
#include "content/browser/storage_partition_impl.h"
#include "content/public/browser/blob_handle.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/content_features.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "services/network/public/cpp/wrapper_shared_url_loader_factory.h"
#include "storage/browser/blob/blob_data_builder.h"
#include "storage/browser/blob/blob_impl.h"
#include "storage/browser/blob/blob_memory_controller.h"
#include "storage/browser/blob/blob_registry_impl.h"
#include "storage/browser/blob/blob_storage_context.h"
#include "storage/browser/blob/blob_url_loader_factory.h"
#include "storage/browser/blob/blob_url_registry.h"
#include "storage/browser/file_system/file_system_context.h"
FilePath;
UserDataAdapter;
BlobStorageContext;
namespace content {
namespace {
const FilePath::CharType kBlobStorageParentDirectory[] = …);
void RemoveOldBlobStorageDirectories(FilePath blob_storage_parent,
const FilePath& current_run_dir) { … }
class BlobHandleImpl : public BlobHandle { … };
}
ChromeBlobStorageContext::ChromeBlobStorageContext() { … }
ChromeBlobStorageContext* ChromeBlobStorageContext::GetFor(
BrowserContext* context) { … }
mojo::PendingRemote<storage::mojom::BlobStorageContext>
ChromeBlobStorageContext::GetRemoteFor(BrowserContext* browser_context) { … }
void ChromeBlobStorageContext::InitializeOnIOThread(
const FilePath& profile_dir,
const FilePath& blob_storage_dir,
scoped_refptr<base::TaskRunner> file_task_runner) { … }
storage::BlobStorageContext* ChromeBlobStorageContext::context() const { … }
void ChromeBlobStorageContext::BindMojoContext(
mojo::PendingReceiver<storage::mojom::BlobStorageContext> receiver) { … }
std::unique_ptr<BlobHandle> ChromeBlobStorageContext::CreateMemoryBackedBlob(
base::span<const uint8_t> data,
const std::string& content_type) { … }
void ChromeBlobStorageContext::CreateFileSystemBlobWithFileAccess(
scoped_refptr<storage::FileSystemContext> file_system_context,
mojo::PendingReceiver<blink::mojom::Blob> blob_receiver,
const storage::FileSystemURL& url,
const std::string& blob_uuid,
const std::string& content_type,
const uint64_t file_size,
const base::Time& file_modification_time,
file_access::ScopedFileAccessDelegate::RequestFilesAccessIOCallback
file_access) { … }
void ChromeBlobStorageContext::CreateFileSystemBlob(
scoped_refptr<storage::FileSystemContext> file_system_context,
mojo::PendingReceiver<blink::mojom::Blob> blob_receiver,
const storage::FileSystemURL& url,
const std::string& blob_uuid,
const std::string& content_type,
const uint64_t file_size,
const base::Time& file_modification_time) { … }
scoped_refptr<network::SharedURLLoaderFactory>
ChromeBlobStorageContext::URLLoaderFactoryForToken(
StoragePartition* storage_partition,
mojo::PendingRemote<blink::mojom::BlobURLToken> token) { … }
scoped_refptr<network::SharedURLLoaderFactory>
ChromeBlobStorageContext::URLLoaderFactoryForUrl(
StoragePartition* storage_partition,
const GURL& url) { … }
mojo::PendingRemote<blink::mojom::Blob> ChromeBlobStorageContext::GetBlobRemote(
BrowserContext* browser_context,
const std::string& uuid) { … }
ChromeBlobStorageContext::~ChromeBlobStorageContext() = default;
storage::BlobStorageContext* GetBlobStorageContext(
ChromeBlobStorageContext* blob_storage_context) { … }
const char kBlobStorageContextKeyName[] = …;
}