https://bugs.webkit.org/show_bug.cgi?id=143559
Reviewed by David Kilzer.
Source/WebCore:
* loader/ContentFilter.cpp:
(WebCore::ContentFilter::types): Only registered ParentalControlsContentFilter if HAVE(PARENTAL_CONTROLS).
* platform/ContentFilterUnblockHandler.h: Changed PLATFORM(IOS) to HAVE(PARENTAL_CONTROLS).
* platform/cocoa/ContentFilterUnblockHandlerCocoa.mm:
(WebCore::ContentFilterUnblockHandler::wrapWithDecisionHandler): Ditto.
(WebCore::ContentFilterUnblockHandler::needsUIProcess): Ditto.
(WebCore::ContentFilterUnblockHandler::encode): Ditto.
(WebCore::ContentFilterUnblockHandler::decode): Ditto.
(WebCore::ContentFilterUnblockHandler::canHandleRequest): Ditto.
(WebCore::ContentFilterUnblockHandler::requestUnblockAsync): Ditto.
* platform/cocoa/ParentalControlsContentFilter.mm: Wrapped the file with HAVE(PARENTAL_CONTROLS)
Source/WTF:
Added PLATFORM(WATCHOS). Used PLATFORM() since Watch OS is just a variant of OS(IOS).
Defined HAVE(PARENTAL_CONTROLS) to be true on all Cocoa platforms except Watch OS.
* wtf/Platform.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182596
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2015-04-09 Andy Estes <aestes@apple.com>
+
+ [Content Filtering] Add a HAVE(PARENTAL_CONTROLS) and use it
+ https://bugs.webkit.org/show_bug.cgi?id=143559
+
+ Reviewed by David Kilzer.
+
+ Added PLATFORM(WATCHOS). Used PLATFORM() since Watch OS is just a variant of OS(IOS).
+ Defined HAVE(PARENTAL_CONTROLS) to be true on all Cocoa platforms except Watch OS.
+
+ * wtf/Platform.h:
+
2015-04-08 Alex Christensen <achristensen@webkit.org> and Patrick Gansterer <paroga@webkit.org>
Add CMake build system for WinCairo port.
#define WTF_PLATFORM_APPLETV 1
#endif
+/* PLATFORM(WATCHOS) */
+#if defined(TARGET_OS_WATCH) && TARGET_OS_WATCH
+#define WTF_PLATFORM_WATCHOS 1
+#endif
+
/* Graphics engines */
/* USE(CG) and PLATFORM(CI) */
#define HAVE_OUT_OF_PROCESS_LAYER_HOSTING 1
#define HAVE_DTRACE 1
+#if !PLATFORM(WATCHOS)
+#define HAVE_PARENTAL_CONTROLS 1
+#endif
+
#endif
#if PLATFORM(MAC)
+2015-04-09 Andy Estes <aestes@apple.com>
+
+ [Content Filtering] Add a HAVE(PARENTAL_CONTROLS) and use it
+ https://bugs.webkit.org/show_bug.cgi?id=143559
+
+ Reviewed by David Kilzer.
+
+ * loader/ContentFilter.cpp:
+ (WebCore::ContentFilter::types): Only registered ParentalControlsContentFilter if HAVE(PARENTAL_CONTROLS).
+ * platform/ContentFilterUnblockHandler.h: Changed PLATFORM(IOS) to HAVE(PARENTAL_CONTROLS).
+ * platform/cocoa/ContentFilterUnblockHandlerCocoa.mm:
+ (WebCore::ContentFilterUnblockHandler::wrapWithDecisionHandler): Ditto.
+ (WebCore::ContentFilterUnblockHandler::needsUIProcess): Ditto.
+ (WebCore::ContentFilterUnblockHandler::encode): Ditto.
+ (WebCore::ContentFilterUnblockHandler::decode): Ditto.
+ (WebCore::ContentFilterUnblockHandler::canHandleRequest): Ditto.
+ (WebCore::ContentFilterUnblockHandler::requestUnblockAsync): Ditto.
+ * platform/cocoa/ParentalControlsContentFilter.mm: Wrapped the file with HAVE(PARENTAL_CONTROLS)
+
2015-04-09 Sergio Villar Senin <svillar@igalia.com>
Unreviewed, added CSS Grid Layout to features.json file.
{
static NeverDestroyed<Vector<ContentFilter::Type>> types {
Vector<ContentFilter::Type> {
+#if HAVE(PARENTAL_CONTROLS)
type<ParentalControlsContentFilter>(),
+#endif
#if HAVE(NETWORK_EXTENSION)
type<NetworkExtensionContentFilter>()
#endif
ContentFilterUnblockHandler() = default;
WEBCORE_EXPORT ContentFilterUnblockHandler(String unblockURLHost, UnblockRequesterFunction);
-#if PLATFORM(IOS)
+#if HAVE(PARENTAL_CONTROLS)
ContentFilterUnblockHandler(String unblockURLHost, RetainPtr<WebFilterEvaluator>);
#endif
String m_unblockURLHost;
URL m_unreachableURL;
UnblockRequesterFunction m_unblockRequester;
-#if PLATFORM(IOS)
+#if HAVE(PARENTAL_CONTROLS)
RetainPtr<WebFilterEvaluator> m_webFilterEvaluator;
#endif
};
#endif
#if PLATFORM(IOS)
-#import "SoftLinking.h"
#import "WebCoreThreadRun.h"
+#endif
+
+#if HAVE(PARENTAL_CONTROLS)
+#import "SoftLinking.h"
#import "WebFilterEvaluatorSPI.h"
SOFT_LINK_PRIVATE_FRAMEWORK(WebContentAnalysis);
LOG(ContentFiltering, "Creating ContentFilterUnblockHandler with an unblock requester and unblock URL host <%s>.\n", unblockURLHost.ascii().data());
}
-#if PLATFORM(IOS)
+#if HAVE(PARENTAL_CONTROLS)
ContentFilterUnblockHandler::ContentFilterUnblockHandler(String unblockURLHost, RetainPtr<WebFilterEvaluator> evaluator)
: m_unblockURLHost { WTF::move(unblockURLHost) }
, m_webFilterEvaluator { WTF::move(evaluator) }
decisionHandler(unblocked);
});
}};
-#if PLATFORM(IOS)
+#if HAVE(PARENTAL_CONTROLS)
m_webFilterEvaluator = nullptr;
#endif
std::swap(m_unblockRequester, wrappedRequester);
bool ContentFilterUnblockHandler::needsUIProcess() const
{
-#if PLATFORM(IOS)
+#if HAVE(PARENTAL_CONTROLS)
return m_webFilterEvaluator;
#else
return false;
BEGIN_BLOCK_OBJC_EXCEPTIONS;
[coder encodeObject:m_unblockURLHost forKey:unblockURLHostKey];
[coder encodeObject:(NSURL *)m_unreachableURL forKey:unreachableURLKey];
-#if PLATFORM(IOS)
+#if HAVE(PARENTAL_CONTROLS)
[coder encodeObject:m_webFilterEvaluator.get() forKey:webFilterEvaluatorKey];
#endif
END_BLOCK_OBJC_EXCEPTIONS;
BEGIN_BLOCK_OBJC_EXCEPTIONS;
unblockHandler.m_unblockURLHost = [coder decodeObjectOfClass:[NSString class] forKey:unblockURLHostKey];
unblockHandler.m_unreachableURL = [coder decodeObjectOfClass:[NSURL class] forKey:unreachableURLKey];
-#if PLATFORM(IOS)
+#if HAVE(PARENTAL_CONTROLS)
unblockHandler.m_webFilterEvaluator = [coder decodeObjectOfClass:getWebFilterEvaluatorClass() forKey:webFilterEvaluatorKey];
#endif
return true;
bool ContentFilterUnblockHandler::canHandleRequest(const ResourceRequest& request) const
{
if (!m_unblockRequester) {
-#if PLATFORM(IOS)
+#if HAVE(PARENTAL_CONTROLS)
if (!m_webFilterEvaluator)
return false;
#else
void ContentFilterUnblockHandler::requestUnblockAsync(DecisionHandlerFunction decisionHandler) const
{
-#if PLATFORM(IOS)
+#if HAVE(PARENTAL_CONTROLS)
if (m_webFilterEvaluator) {
[m_webFilterEvaluator unblockWithCompletion:[decisionHandler](BOOL unblocked, NSError *) {
dispatchToMainThread([decisionHandler, unblocked] {
#import "config.h"
#import "ParentalControlsContentFilter.h"
+#if HAVE(PARENTAL_CONTROLS)
+
#import "ContentFilterUnblockHandler.h"
#import "Logging.h"
#import "ResourceResponse.h"
}
} // namespace WebCore
+
+#endif // HAVE(PARENTAL_CONTROLS)