ResourceLoadDelegate.h [plain text]
#pragma once
#import "APIResourceLoadClient.h"
#import "WKFoundation.h"
#import <wtf/WeakObjCPtr.h>
@class WKWebView;
@protocol _WKResourceLoadDelegate;
namespace API {
class ResourceLoadClient;
}
namespace WebKit {
class ResourceLoadDelegate {
WTF_MAKE_FAST_ALLOCATED;
public:
explicit ResourceLoadDelegate(WKWebView *);
~ResourceLoadDelegate();
std::unique_ptr<API::ResourceLoadClient> createResourceLoadClient();
RetainPtr<id<_WKResourceLoadDelegate>> delegate();
void setDelegate(id<_WKResourceLoadDelegate>);
private:
class ResourceLoadClient : public API::ResourceLoadClient {
WTF_MAKE_FAST_ALLOCATED;
public:
explicit ResourceLoadClient(ResourceLoadDelegate&);
~ResourceLoadClient();
private:
void didSendRequest(ResourceLoadInfo&&, WebCore::ResourceRequest&&) const final;
void didPerformHTTPRedirection(ResourceLoadInfo&&, WebCore::ResourceResponse&&, WebCore::ResourceRequest&&) const final;
void didReceiveChallenge(ResourceLoadInfo&&, WebCore::AuthenticationChallenge&&) const final;
void didReceiveResponse(ResourceLoadInfo&&, WebCore::ResourceResponse&&) const final;
void didCompleteWithError(ResourceLoadInfo&&, WebCore::ResourceResponse&&, WebCore::ResourceError&&) const final;
ResourceLoadDelegate& m_resourceLoadDelegate;
};
WeakObjCPtr<WKWebView> m_webView;
WeakObjCPtr<id <_WKResourceLoadDelegate> > m_delegate;
struct {
bool didSendRequest : 1;
bool didPerformHTTPRedirection : 1;
bool didReceiveChallenge : 1;
bool didReceiveResponse : 1;
bool didCompleteWithError : 1;
} m_delegateMethods;
};
}