#include "components/background_fetch/download_client.h"
#include <memory>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include "base/functional/bind.h"
#include "base/task/sequenced_task_runner.h"
#include "components/background_fetch/background_fetch_delegate_base.h"
#include "components/download/public/background_service/background_download_service.h"
#include "components/download/public/background_service/download_metadata.h"
#include "content/public/browser/background_fetch_response.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "services/network/public/cpp/resource_request_body.h"
#include "url/origin.h"
namespace background_fetch {
namespace {
BackgroundFetchFailureReason;
BackgroundFetchFailureReason ToBackgroundFetchFailureReason(
download::Client::FailureReason reason) { … }
}
DownloadClient::DownloadClient(content::BrowserContext* context)
: … { … }
DownloadClient::~DownloadClient() = default;
void DownloadClient::OnServiceInitialized(
bool state_lost,
const std::vector<download::DownloadMetaData>& downloads) { … }
void DownloadClient::OnServiceUnavailable() { … }
void DownloadClient::OnDownloadStarted(
const std::string& guid,
const std::vector<GURL>& url_chain,
const scoped_refptr<const net::HttpResponseHeaders>& headers) { … }
void DownloadClient::OnDownloadUpdated(const std::string& guid,
uint64_t bytes_uploaded,
uint64_t bytes_downloaded) { … }
void DownloadClient::OnDownloadFailed(const std::string& guid,
const download::CompletionInfo& info,
download::Client::FailureReason reason) { … }
void DownloadClient::OnDownloadSucceeded(const std::string& guid,
const download::CompletionInfo& info) { … }
bool DownloadClient::CanServiceRemoveDownloadedFile(const std::string& guid,
bool force_delete) { … }
void DownloadClient::GetUploadData(const std::string& guid,
download::GetUploadDataCallback callback) { … }
BackgroundFetchDelegateBase* DownloadClient::GetDelegate() { … }
}