PendingDownload.cpp [plain text]
#include "config.h"
#include "PendingDownload.h"
#if USE(NETWORK_SESSION)
#include "DataReference.h"
#include "DownloadProxyMessages.h"
#include "NetworkLoad.h"
#include "NetworkProcess.h"
#include "WebCoreArgumentCoders.h"
using namespace WebCore;
namespace WebKit {
PendingDownload::PendingDownload(NetworkLoadParameters&& parameters, DownloadID downloadID, NetworkSession& networkSession)
: m_networkLoad(std::make_unique<NetworkLoad>(*this, WTFMove(parameters), networkSession))
{
m_networkLoad->setPendingDownloadID(downloadID);
m_networkLoad->setPendingDownload(*this);
}
void PendingDownload::willSendRedirectedRequest(WebCore::ResourceRequest&&, WebCore::ResourceRequest&& redirectRequest, WebCore::ResourceResponse&& redirectResponse)
{
send(Messages::DownloadProxy::WillSendRequest(WTFMove(redirectRequest), WTFMove(redirectResponse)));
};
void PendingDownload::continueWillSendRequest(WebCore::ResourceRequest&& newRequest)
{
m_networkLoad->continueWillSendRequest(WTFMove(newRequest));
}
void PendingDownload::canAuthenticateAgainstProtectionSpaceAsync(const WebCore::ProtectionSpace& protectionSpace)
{
send(Messages::DownloadProxy::CanAuthenticateAgainstProtectionSpace(protectionSpace));
}
void PendingDownload::continueCanAuthenticateAgainstProtectionSpace(bool canAuthenticate)
{
m_networkLoad->continueCanAuthenticateAgainstProtectionSpace(canAuthenticate);
}
void PendingDownload::didBecomeDownload()
{
m_networkLoad = nullptr;
}
void PendingDownload::didFailLoading(const WebCore::ResourceError& error)
{
send(Messages::DownloadProxy::DidFail(error, { }));
}
IPC::Connection* PendingDownload::messageSenderConnection()
{
return NetworkProcess::singleton().parentProcessConnection();
}
uint64_t PendingDownload::messageSenderDestinationID()
{
return m_networkLoad->pendingDownloadID().downloadID();
}
}
#endif