#include "chrome/browser/download/deferred_client_wrapper.h"
#include <vector>
#include "base/functional/bind.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/transition_manager/full_browser_transition_manager.h"
#include "components/download/public/background_service/clients.h"
#include "components/download/public/background_service/download_metadata.h"
#include "components/keyed_service/core/simple_factory_key.h"
#if BUILDFLAG(IS_ANDROID)
#include "chrome/browser/android/startup_bridge.h"
#endif
namespace download {
DeferredClientWrapper::DeferredClientWrapper(ClientFactory client_factory,
SimpleFactoryKey* key)
: … { … }
DeferredClientWrapper::~DeferredClientWrapper() = default;
void DeferredClientWrapper::OnServiceInitialized(
bool state_lost,
const std::vector<DownloadMetaData>& downloads) { … }
void DeferredClientWrapper::OnServiceUnavailable() { … }
void DeferredClientWrapper::OnDownloadStarted(
const std::string& guid,
const std::vector<GURL>& url_chain,
const scoped_refptr<const net::HttpResponseHeaders>& headers) { … }
void DeferredClientWrapper::OnDownloadUpdated(const std::string& guid,
uint64_t bytes_uploaded,
uint64_t bytes_downloaded) { … }
void DeferredClientWrapper::OnDownloadFailed(
const std::string& guid,
const download::CompletionInfo& info,
FailureReason reason) { … }
void DeferredClientWrapper::OnDownloadSucceeded(
const std::string& guid,
const CompletionInfo& completion_info) { … }
bool DeferredClientWrapper::CanServiceRemoveDownloadedFile(
const std::string& guid,
bool force_delete) { … }
void DeferredClientWrapper::GetUploadData(
const std::string& guid,
GetUploadDataCallback upload_callback) { … }
void DeferredClientWrapper::ForwardOnServiceInitialized(
bool state_lost,
const std::vector<DownloadMetaData>& downloads) { … }
void DeferredClientWrapper::ForwardOnServiceUnavailable() { … }
void DeferredClientWrapper::ForwardOnDownloadStarted(
const std::string& guid,
const std::vector<GURL>& url_chain,
const scoped_refptr<const net::HttpResponseHeaders>& headers) { … }
void DeferredClientWrapper::ForwardOnDownloadUpdated(
const std::string& guid,
uint64_t bytes_uploaded,
uint64_t bytes_downloaded) { … }
void DeferredClientWrapper::ForwardOnDownloadFailed(
const std::string& guid,
const download::CompletionInfo& info,
FailureReason reason) { … }
void DeferredClientWrapper::ForwardOnDownloadSucceeded(
const std::string& guid,
const CompletionInfo& completion_info) { … }
void DeferredClientWrapper::ForwardCanServiceRemoveDownloadedFile(
const std::string& guid,
bool force_delete) { … }
void DeferredClientWrapper::ForwardGetUploadData(
const std::string& guid,
GetUploadDataCallback callback) { … }
void DeferredClientWrapper::RunDeferredClosures(bool force_inflate) { … }
void DeferredClientWrapper::DoRunDeferredClosures() { … }
void DeferredClientWrapper::InflateClient(Profile* profile) { … }
#if BUILDFLAG(IS_ANDROID)
void DeferredClientWrapper::LaunchFullBrowser() {
if (full_browser_requested_)
return;
full_browser_requested_ = true;
android_startup::LoadFullBrowser();
}
#endif
}