ContentFilterUnblockHandler.h [plain text]
#ifndef ContentFilterUnblockHandler_h
#define ContentFilterUnblockHandler_h
#if ENABLE(CONTENT_FILTERING)
#include "URL.h"
#include <functional>
#include <wtf/RetainPtr.h>
#include <wtf/text/WTFString.h>
OBJC_CLASS NSCoder;
#if PLATFORM(IOS)
OBJC_CLASS WebFilterEvaluator;
#endif
namespace WebCore {
class ResourceRequest;
class ContentFilterUnblockHandler {
public:
using DecisionHandlerFunction = std::function<void(bool unblocked)>;
using UnblockRequesterFunction = std::function<void(DecisionHandlerFunction)>;
ContentFilterUnblockHandler() = default;
WEBCORE_EXPORT ContentFilterUnblockHandler(String unblockURLHost, UnblockRequesterFunction);
#if HAVE(PARENTAL_CONTROLS) && PLATFORM(IOS)
ContentFilterUnblockHandler(String unblockURLHost, RetainPtr<WebFilterEvaluator>);
#endif
WEBCORE_EXPORT bool needsUIProcess() const;
WEBCORE_EXPORT void encode(NSCoder *) const;
WEBCORE_EXPORT static bool decode(NSCoder *, ContentFilterUnblockHandler&);
WEBCORE_EXPORT bool canHandleRequest(const ResourceRequest&) const;
WEBCORE_EXPORT void requestUnblockAsync(DecisionHandlerFunction) const;
void wrapWithDecisionHandler(const DecisionHandlerFunction&);
const String& unblockURLHost() const { return m_unblockURLHost; }
const URL& unreachableURL() const { return m_unreachableURL; }
void setUnreachableURL(const URL& url) { m_unreachableURL = url; }
private:
String m_unblockURLHost;
URL m_unreachableURL;
UnblockRequesterFunction m_unblockRequester;
#if HAVE(PARENTAL_CONTROLS) && PLATFORM(IOS)
RetainPtr<WebFilterEvaluator> m_webFilterEvaluator;
#endif
};
}
#endif // ENABLE(CONTENT_FILTERING)
#endif // ContentFilterUnblockHandler_h