WebFramePolicyListenerProxy.h [plain text]
#pragma once
#include "APIObject.h"
#include "PolicyDecision.h"
#include <WebCore/FrameLoaderTypes.h>
#include <wtf/CompletionHandler.h>
#include <wtf/Vector.h>
namespace API {
class WebsitePolicies;
}
namespace WebKit {
class SafeBrowsingWarning;
enum class ProcessSwapRequestedByClient : bool { No, Yes };
enum class ShouldExpectSafeBrowsingResult : bool { No, Yes };
enum class ShouldExpectAppBoundDomainResult : bool { No, Yes };
class WebFramePolicyListenerProxy : public API::ObjectImpl<API::Object::Type::FramePolicyListener> {
public:
using Reply = CompletionHandler<void(WebCore::PolicyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&&, Optional<NavigatingToAppBoundDomain>)>;
static Ref<WebFramePolicyListenerProxy> create(Reply&& reply, ShouldExpectSafeBrowsingResult expectSafeBrowsingResult, ShouldExpectAppBoundDomainResult expectAppBoundDomainResult)
{
return adoptRef(*new WebFramePolicyListenerProxy(WTFMove(reply), expectSafeBrowsingResult, expectAppBoundDomainResult));
}
~WebFramePolicyListenerProxy();
void use(API::WebsitePolicies* = nullptr, ProcessSwapRequestedByClient = ProcessSwapRequestedByClient::No);
void download();
void ignore();
void didReceiveSafeBrowsingResults(RefPtr<SafeBrowsingWarning>&&);
void didReceiveAppBoundDomainResult(Optional<NavigatingToAppBoundDomain>);
private:
WebFramePolicyListenerProxy(Reply&&, ShouldExpectSafeBrowsingResult, ShouldExpectAppBoundDomainResult);
Optional<std::pair<RefPtr<API::WebsitePolicies>, ProcessSwapRequestedByClient>> m_policyResult;
Optional<RefPtr<SafeBrowsingWarning>> m_safeBrowsingWarning;
Optional<Optional<NavigatingToAppBoundDomain>> m_isNavigatingToAppBoundDomain;
Reply m_reply;
};
}