#include "third_party/blink/public/common/loader/mime_sniffing_url_loader.h"
#include <string_view>
#include "base/containers/span.h"
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/task/sequenced_task_runner.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "net/base/mime_sniffer.h"
#include "services/network/public/cpp/record_ontransfersizeupdate_utils.h"
#include "services/network/public/mojom/early_hints.mojom.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "third_party/blink/public/common/loader/mime_sniffing_throttle.h"
namespace blink {
const char MimeSniffingURLLoader::kDefaultMimeType[] = …;
std::tuple<mojo::PendingRemote<network::mojom::URLLoader>,
mojo::PendingReceiver<network::mojom::URLLoaderClient>,
MimeSniffingURLLoader*>
MimeSniffingURLLoader::CreateLoader(
base::WeakPtr<MimeSniffingThrottle> throttle,
const GURL& response_url,
network::mojom::URLResponseHeadPtr response_head,
scoped_refptr<base::SequencedTaskRunner> task_runner) { … }
MimeSniffingURLLoader::MimeSniffingURLLoader(
base::WeakPtr<MimeSniffingThrottle> throttle,
const GURL& response_url,
network::mojom::URLResponseHeadPtr response_head,
mojo::PendingRemote<network::mojom::URLLoaderClient>
destination_url_loader_client,
scoped_refptr<base::SequencedTaskRunner> task_runner)
: … { … }
MimeSniffingURLLoader::~MimeSniffingURLLoader() = default;
void MimeSniffingURLLoader::Start(
mojo::PendingRemote<network::mojom::URLLoader> source_url_loader_remote,
mojo::PendingReceiver<network::mojom::URLLoaderClient>
source_url_client_receiver,
mojo::ScopedDataPipeConsumerHandle body) { … }
void MimeSniffingURLLoader::OnReceiveEarlyHints(
network::mojom::EarlyHintsPtr early_hints) { … }
void MimeSniffingURLLoader::OnReceiveResponse(
network::mojom::URLResponseHeadPtr response_head,
mojo::ScopedDataPipeConsumerHandle body,
std::optional<mojo_base::BigBuffer> cached_metadata) { … }
void MimeSniffingURLLoader::OnReceiveRedirect(
const net::RedirectInfo& redirect_info,
network::mojom::URLResponseHeadPtr response_head) { … }
void MimeSniffingURLLoader::OnUploadProgress(
int64_t current_position,
int64_t total_size,
OnUploadProgressCallback ack_callback) { … }
void MimeSniffingURLLoader::OnTransferSizeUpdated(int32_t transfer_size_diff) { … }
void MimeSniffingURLLoader::OnComplete(
const network::URLLoaderCompletionStatus& status) { … }
void MimeSniffingURLLoader::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) { … }
void MimeSniffingURLLoader::SetPriority(net::RequestPriority priority,
int32_t intra_priority_value) { … }
void MimeSniffingURLLoader::PauseReadingBodyFromNet() { … }
void MimeSniffingURLLoader::ResumeReadingBodyFromNet() { … }
void MimeSniffingURLLoader::OnBodyReadable(MojoResult) { … }
void MimeSniffingURLLoader::OnBodyWritable(MojoResult) { … }
void MimeSniffingURLLoader::CompleteSniffing() { … }
void MimeSniffingURLLoader::CompleteSending() { … }
void MimeSniffingURLLoader::SendReceivedBodyToClient() { … }
void MimeSniffingURLLoader::ForwardBodyToClient() { … }
void MimeSniffingURLLoader::Abort() { … }
}