#include "components/download/internal/background_service/in_memory_download.h"
#include <memory>
#include <string>
#include <string_view>
#include "base/functional/bind.h"
#include "base/task/single_thread_task_runner.h"
#include "components/download/internal/background_service/blob_task_proxy.h"
#include "net/base/load_flags.h"
#include "net/traffic_annotation/network_traffic_annotation.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/blob_storage_context.h"
namespace download {
InMemoryDownload::InMemoryDownload(const std::string& guid)
: … { … }
InMemoryDownload::~InMemoryDownload() = default;
InMemoryDownloadImpl::InMemoryDownloadImpl(
const std::string& guid,
const RequestParams& request_params,
scoped_refptr<network::ResourceRequestBody> request_body,
const net::NetworkTrafficAnnotationTag& traffic_annotation,
Delegate* delegate,
network::mojom::URLLoaderFactory* url_loader_factory,
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner)
: … { … }
InMemoryDownloadImpl::~InMemoryDownloadImpl() { … }
void InMemoryDownloadImpl::Start() { … }
void InMemoryDownloadImpl::OnRetrievedBlobContextGetter(
BlobContextGetter blob_context_getter) { … }
void InMemoryDownloadImpl::Pause() { … }
void InMemoryDownloadImpl::Resume() { … }
std::unique_ptr<storage::BlobDataHandle> InMemoryDownloadImpl::ResultAsBlob()
const { … }
size_t InMemoryDownloadImpl::EstimateMemoryUsage() const { … }
void InMemoryDownloadImpl::OnDataReceived(std::string_view string_piece,
base::OnceClosure resume) { … }
void InMemoryDownloadImpl::OnComplete(bool success) { … }
void InMemoryDownloadImpl::OnRetry(base::OnceClosure start_retry) { … }
void InMemoryDownloadImpl::SaveAsBlob() { … }
void InMemoryDownloadImpl::OnSaveBlobDone(
std::unique_ptr<storage::BlobDataHandle> blob_handle,
storage::BlobStatus status) { … }
void InMemoryDownloadImpl::NotifyDelegateDownloadComplete() { … }
void InMemoryDownloadImpl::SendRequest() { … }
void InMemoryDownloadImpl::OnRedirect(
const GURL& url_before_redirect,
const net::RedirectInfo& redirect_info,
const network::mojom::URLResponseHead& response_head,
std::vector<std::string>* to_be_removed_headers) { … }
void InMemoryDownloadImpl::OnResponseStarted(
const GURL& final_url,
const network::mojom::URLResponseHead& response_head) { … }
void InMemoryDownloadImpl::OnUploadProgress(uint64_t position, uint64_t total) { … }
void InMemoryDownloadImpl::Reset() { … }
}