LegacyDownloadClient.h [plain text]
#pragma once
#import "APIDownloadClient.h"
#import "ProcessThrottler.h"
#import "WKFoundation.h"
#import <wtf/WeakObjCPtr.h>
@protocol _WKDownloadDelegate;
namespace WebCore {
class ResourceError;
class ResourceResponse;
}
namespace WebKit {
class LegacyDownloadClient final : public API::DownloadClient {
WTF_MAKE_FAST_ALLOCATED;
public:
explicit LegacyDownloadClient(id <_WKDownloadDelegate>);
private:
void legacyDidStart(DownloadProxy&) final;
void didReceiveResponse(DownloadProxy&, const WebCore::ResourceResponse&);
void didReceiveData(DownloadProxy&, uint64_t, uint64_t, uint64_t) final;
void decideDestinationWithSuggestedFilename(DownloadProxy&, const WebCore::ResourceResponse&, const String& suggestedFilename, CompletionHandler<void(AllowOverwrite, String)>&&) final;
void didFinish(DownloadProxy&) final;
void didFail(DownloadProxy&, const WebCore::ResourceError&, API::Data*) final;
void legacyDidCancel(DownloadProxy&) final;
void willSendRequest(DownloadProxy&, WebCore::ResourceRequest&&, const WebCore::ResourceResponse&, CompletionHandler<void(WebCore::ResourceRequest&&)>&&) final;
void didReceiveAuthenticationChallenge(DownloadProxy&, AuthenticationChallengeProxy&) final;
void didCreateDestination(DownloadProxy&, const String&) final;
void processDidCrash(DownloadProxy&) final;
#if USE(SYSTEM_PREVIEW)
void takeActivityToken(DownloadProxy&);
void releaseActivityTokenIfNecessary(DownloadProxy&);
#endif
WeakObjCPtr<id <_WKDownloadDelegate>> m_delegate;
#if PLATFORM(IOS_FAMILY) && USE(SYSTEM_PREVIEW)
std::unique_ptr<ProcessThrottler::BackgroundActivity> m_activity;
#endif
struct {
bool downloadDidStart : 1;
bool downloadDidReceiveResponse : 1;
bool downloadDidReceiveData : 1;
bool downloadDidWriteDataTotalBytesWrittenTotalBytesExpectedToWrite : 1;
bool downloadDecideDestinationWithSuggestedFilenameAllowOverwrite : 1;
bool downloadDecideDestinationWithSuggestedFilenameCompletionHandler : 1;
bool downloadDidFinish : 1;
bool downloadDidFail : 1;
bool downloadDidCancel : 1;
bool downloadDidReceiveServerRedirectToURL : 1;
bool downloadDidReceiveAuthenticationChallengeCompletionHandler : 1;
bool downloadShouldDecodeSourceDataOfMIMEType : 1;
bool downloadDidCreateDestination : 1;
bool downloadProcessDidCrash : 1;
} m_delegateMethods;
};
}