NetscapePlugInStreamLoader.h [plain text]
#pragma once
#include "ResourceLoader.h"
#include <wtf/Function.h>
#include <wtf/Forward.h>
#include <wtf/WeakPtr.h>
namespace WebCore {
class NetscapePlugInStreamLoader;
class NetscapePlugInStreamLoaderClient : public CanMakeWeakPtr<NetscapePlugInStreamLoaderClient> {
public:
virtual void willSendRequest(NetscapePlugInStreamLoader*, ResourceRequest&&, const ResourceResponse& redirectResponse, CompletionHandler<void(ResourceRequest&&)>&&) = 0;
virtual void didReceiveResponse(NetscapePlugInStreamLoader*, const ResourceResponse&) = 0;
virtual void didReceiveData(NetscapePlugInStreamLoader*, const char*, int) = 0;
virtual void didFail(NetscapePlugInStreamLoader*, const ResourceError&) = 0;
virtual void didFinishLoading(NetscapePlugInStreamLoader*) { }
virtual bool wantsAllStreams() const { return false; }
protected:
virtual ~NetscapePlugInStreamLoaderClient() = default;
};
class NetscapePlugInStreamLoader final : public ResourceLoader {
public:
WEBCORE_EXPORT static void create(Frame&, NetscapePlugInStreamLoaderClient&, ResourceRequest&&, CompletionHandler<void(RefPtr<NetscapePlugInStreamLoader>&&)>&&);
virtual ~NetscapePlugInStreamLoader();
WEBCORE_EXPORT bool isDone() const;
private:
void init(ResourceRequest&&, CompletionHandler<void(bool)>&&) override;
void willSendRequest(ResourceRequest&&, const ResourceResponse& redirectResponse, CompletionHandler<void(ResourceRequest&&)>&& callback) override;
void didReceiveResponse(const ResourceResponse&, CompletionHandler<void()>&& policyCompletionHandler) override;
void didReceiveData(const char*, unsigned, long long encodedDataLength, DataPayloadType) override;
void didReceiveBuffer(Ref<SharedBuffer>&&, long long encodedDataLength, DataPayloadType) override;
void didFinishLoading(const NetworkLoadMetrics&) override;
void didFail(const ResourceError&) override;
void releaseResources() override;
NetscapePlugInStreamLoader(Frame&, NetscapePlugInStreamLoaderClient&);
void willCancel(const ResourceError&) override;
void didCancel(const ResourceError&) override;
void didReceiveDataOrBuffer(const char*, int, RefPtr<SharedBuffer>&&, long long encodedDataLength, DataPayloadType);
void notifyDone();
WeakPtr<NetscapePlugInStreamLoaderClient> m_client;
bool m_isInitialized { false };
};
}