#include "storage/browser/blob/blob_url_loader.h"
#include <stddef.h>
#include <utility>
#include "base/check_op.h"
#include "base/format_macros.h"
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/memory/weak_ptr.h"
#include "base/notreached.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/task/sequenced_task_runner.h"
#include "net/base/io_buffer.h"
#include "net/http/http_byte_range.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_response_info.h"
#include "net/http/http_status_code.h"
#include "net/http/http_util.h"
#include "services/network/public/cpp/constants.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "storage/browser/blob/blob_data_handle.h"
#include "storage/browser/blob/mojo_blob_reader.h"
#include "third_party/blink/public/common/blob/blob_utils.h"
namespace storage {
namespace {
scoped_refptr<net::HttpResponseHeaders> GenerateHeaders(
net::HttpStatusCode status_code,
BlobDataHandle* blob_handle,
net::HttpByteRange* byte_range,
uint64_t total_size,
uint64_t content_size) { … }
}
void BlobURLLoader::CreateAndStart(
mojo::PendingReceiver<network::mojom::URLLoader> url_loader_receiver,
const network::ResourceRequest& request,
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
std::unique_ptr<BlobDataHandle> blob_handle) { … }
void BlobURLLoader::CreateAndStart(
mojo::PendingReceiver<network::mojom::URLLoader> url_loader_receiver,
const std::string& method,
const net::HttpRequestHeaders& headers,
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
std::unique_ptr<BlobDataHandle> blob_handle) { … }
BlobURLLoader::~BlobURLLoader() = default;
BlobURLLoader::BlobURLLoader(
mojo::PendingReceiver<network::mojom::URLLoader> url_loader_receiver,
const std::string& method,
const net::HttpRequestHeaders& headers,
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
std::unique_ptr<BlobDataHandle> blob_handle)
: … { … }
void BlobURLLoader::Start(const std::string& method,
const net::HttpRequestHeaders& headers) { … }
void BlobURLLoader::FollowRedirect(
const std::vector<std::string>& removed_headers,
const net::HttpRequestHeaders& modified_headers,
const net::HttpRequestHeaders& modified_cors_exempt_headers,
const std::optional<GURL>& new_url) { … }
MojoBlobReader::Delegate::RequestSideData BlobURLLoader::DidCalculateSize(
uint64_t total_size,
uint64_t content_size) { … }
void BlobURLLoader::DidReadSideData(std::optional<mojo_base::BigBuffer> data) { … }
void BlobURLLoader::OnComplete(net::Error error_code,
uint64_t total_written_bytes) { … }
void BlobURLLoader::HeadersCompleted(
net::HttpStatusCode status_code,
uint64_t content_size,
std::optional<mojo_base::BigBuffer> metadata) { … }
}