[Content Filtering] Move WebFilterEvaluator and NEFilterSource declarations to SPI...
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Feb 2015 00:09:03 +0000 (00:09 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Feb 2015 00:09:03 +0000 (00:09 +0000)
https://bugs.webkit.org/show_bug.cgi?id=142062

Reviewed by Daniel Bates.

* WebCore.xcodeproj/project.pbxproj:
* platform/mac/ContentFilterMac.mm:
* platform/spi/cocoa/NEFilterSourceSPI.h: Added.
* platform/spi/cocoa/WebFilterEvaluatorSPI.h: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@180708 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/mac/ContentFilterMac.mm
Source/WebCore/platform/spi/cocoa/NEFilterSourceSPI.h [new file with mode: 0644]
Source/WebCore/platform/spi/cocoa/WebFilterEvaluatorSPI.h [new file with mode: 0644]

index 87f9864..7a9354e 100644 (file)
@@ -1,3 +1,15 @@
+2015-02-26  Andy Estes  <aestes@apple.com>
+
+        [Content Filtering] Move WebFilterEvaluator and NEFilterSource declarations to SPI headers
+        https://bugs.webkit.org/show_bug.cgi?id=142062
+
+        Reviewed by Daniel Bates.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/mac/ContentFilterMac.mm:
+        * platform/spi/cocoa/NEFilterSourceSPI.h: Added.
+        * platform/spi/cocoa/WebFilterEvaluatorSPI.h: Added.
+
 2015-02-26  Anders Carlsson  <andersca@apple.com>
 
         Add API to remove all website data for the given data records
index 859ce79..5b2bc53 100644 (file)
                A14832CF187F684700DA63A6 /* WebCoreThreadSystemInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = A14832A1187F508700DA63A6 /* WebCoreThreadSystemInterface.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A17C81220F2A5CF7005DAAEB /* HTMLElementFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */; };
                A17C81230F2A5CF7005DAAEB /* HTMLElementFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */; };
+               A19D93461A9FEC7200B46C24 /* NEFilterSourceSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A19D93441A9FEC7200B46C24 /* NEFilterSourceSPI.h */; };
+               A19D93471A9FEC7200B46C24 /* WebFilterEvaluatorSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A19D93451A9FEC7200B46C24 /* WebFilterEvaluatorSPI.h */; };
                A1C797181883DD82000F5E1F /* DOMGestureEvent.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 0F54DCDD1880F901003EEDBB /* DOMGestureEvent.h */; };
                A1C797191883DDED000F5E1F /* DOMTouch.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 0F54DCCD1880F867003EEDBB /* DOMTouch.h */; };
                A1C7971A1883DE0D000F5E1F /* DOMTouchEvent.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 0F54DCCF1880F867003EEDBB /* DOMTouchEvent.h */; };
                7C74D4391882400400E5ED57 /* UTextProviderUTF16.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UTextProviderUTF16.cpp; sourceTree = "<group>"; };
                7C74D43A1882400400E5ED57 /* UTextProviderUTF16.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTextProviderUTF16.h; sourceTree = "<group>"; };
                7C9DBFEA1A9C489F000D6B25 /* HTMLAttachmentElement.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = HTMLAttachmentElement.idl; sourceTree = "<group>"; };
-               7C9DBFEB1A9C49B1000D6B25 /* JSHTMLAttachmentElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSHTMLAttachmentElement.cpp; path = JSHTMLAttachmentElement.cpp; sourceTree = "<group>"; };
-               7C9DBFEC1A9C49B1000D6B25 /* JSHTMLAttachmentElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSHTMLAttachmentElement.h; path = JSHTMLAttachmentElement.h; sourceTree = "<group>"; };
+               7C9DBFEB1A9C49B1000D6B25 /* JSHTMLAttachmentElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLAttachmentElement.cpp; sourceTree = "<group>"; };
+               7C9DBFEC1A9C49B1000D6B25 /* JSHTMLAttachmentElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLAttachmentElement.h; sourceTree = "<group>"; };
                7CC564B618BABEA6001B9652 /* TelephoneNumberDetector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TelephoneNumberDetector.h; sourceTree = "<group>"; };
                7CC564B918BAC720001B9652 /* TelephoneNumberDetectorCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TelephoneNumberDetectorCocoa.cpp; sourceTree = "<group>"; };
                7CC6993E191EC5F500AF2270 /* JSWebKitNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitNamespace.cpp; sourceTree = "<group>"; };
                A14832AB187F508700DA63A6 /* WKViewPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKViewPrivate.h; path = ios/wak/WKViewPrivate.h; sourceTree = "<group>"; };
                A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLElementFactory.cpp; sourceTree = "<group>"; };
                A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLElementFactory.h; sourceTree = "<group>"; };
+               A19D93441A9FEC7200B46C24 /* NEFilterSourceSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NEFilterSourceSPI.h; sourceTree = "<group>"; };
+               A19D93451A9FEC7200B46C24 /* WebFilterEvaluatorSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFilterEvaluatorSPI.h; sourceTree = "<group>"; };
                A1C7971C1883E51F000F5E1F /* DOMHTMLTextAreaElementPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHTMLTextAreaElementPrivate.h; sourceTree = "<group>"; };
                A1C7FAA1133A5D3500D6732D /* JSXPathResultCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXPathResultCustom.cpp; sourceTree = "<group>"; };
                A1DE712B18612AC100734192 /* TouchEvents.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TouchEvents.cpp; sourceTree = "<group>"; };
                                44DFF6421A6FF92700D45EEC /* IOSurfaceSPI.h */,
                                44EFF6421A6FF92700D45EEC /* IOTypesSPI.h */,
                                CE12524E1A1A78D200864480 /* MachVMSPI.h */,
+                               A19D93441A9FEC7200B46C24 /* NEFilterSourceSPI.h */,
                                CE1252501A1BEBD800864480 /* NSCalendarDateSPI.h */,
                                2DDB97F319F9AECA002025D8 /* NSExtensionSPI.h */,
                                CE12523A1A16711000864480 /* NSFileManagerSPI.h */,
                                653EF83819A043AE0052202C /* NSURLFileTypeMappingsSPI.h */,
                                CE12523C1A1676CD00864480 /* QuartzCoreSPI.h */,
                                CEC337AC1A46071F009B8523 /* ServersSPI.h */,
+                               A19D93451A9FEC7200B46C24 /* WebFilterEvaluatorSPI.h */,
                        );
                        path = cocoa;
                        sourceTree = "<group>";
                                E145349716A9BB6A000F6FD2 /* DOMTransitionEvent.h in Headers */,
                                E145349916A9BB6A000F6FD2 /* DOMTransitionEventInternal.h in Headers */,
                                BC1A37BE097C715F0019F3D8 /* DOMTraversal.h in Headers */,
+                               A19D93471A9FEC7200B46C24 /* WebFilterEvaluatorSPI.h in Headers */,
                                85526CD20AB0B7D9000302EA /* DOMTreeWalker.h in Headers */,
                                850B41C30AD9E7E700A6ED4F /* DOMTreeWalkerInternal.h in Headers */,
                                85C7F4910AAF79DC004014DD /* DOMUIEvent.h in Headers */,
                                BE61039E18A9D65A00DD50D7 /* JSDataCue.h in Headers */,
                                BCA83E500D7CE1E9003421A8 /* JSDataTransfer.h in Headers */,
                                4162A4581011464700DFF3ED /* JSDedicatedWorkerGlobalScope.h in Headers */,
+                               A19D93461A9FEC7200B46C24 /* NEFilterSourceSPI.h in Headers */,
                                FDA15ED212B03F94003A583A /* JSDelayNode.h in Headers */,
                                31FB1A66120A5D3F00DC02A0 /* JSDeviceMotionEvent.h in Headers */,
                                59A86008119DAFA100DEF1EF /* JSDeviceOrientationEvent.h in Headers */,
index 4bd7e1f..285b01a 100644 (file)
 
 #import "ResourceResponse.h"
 #import "SoftLinking.h"
+#import "WebFilterEvaluatorSPI.h"
 #import <objc/runtime.h>
 
-#if defined(__has_include) && __has_include(<WebContentAnalysis/WebFilterEvaluator.h>)
-#import <WebContentAnalysis/WebFilterEvaluator.h>
-#else
-static const OSStatus kWFEStateBuffering = 2;
-@interface WebFilterEvaluator : NSObject
-+ (BOOL)isManagedSession;
-- (BOOL)wasBlocked;
-- (NSData *)addData:(NSData *)receivedData;
-- (NSData *)dataComplete;
-- (OSStatus)filterState;
-- (id)initWithResponse:(NSURLResponse *)response;
-@end
-#endif
-
-SOFT_LINK_PRIVATE_FRAMEWORK(WebContentAnalysis);
-SOFT_LINK_CLASS(WebContentAnalysis, WebFilterEvaluator);
-
 #if HAVE(NE_FILTER_SOURCE)
-
-#if defined(__has_include) && __has_include(<NetworkExtension/NEFilterSource.h>)
-#import <NetworkExtension/NEFilterSource.h>
-#else
-typedef NS_ENUM(NSInteger, NEFilterSourceStatus) {
-    NEFilterSourceStatusPass = 1,
-    NEFilterSourceStatusBlock = 2,
-    NEFilterSourceStatusNeedsMoreData = 3,
-    NEFilterSourceStatusError = 4,
-};
-
-typedef NS_ENUM(NSInteger, NEFilterSourceDirection) {
-    NEFilterSourceDirectionOutbound = 1,
-    NEFilterSourceDirectionInbound = 2,
-};
-
-@interface NEFilterSource : NSObject
-+ (BOOL)filterRequired;
-- (id)initWithURL:(NSURL *)url direction:(NEFilterSourceDirection)direction socketIdentifier:(uint64_t)socketIdentifier;
-- (void)addData:(NSData *)data withCompletionQueue:(dispatch_queue_t)queue completionHandler:(void (^)(NEFilterSourceStatus, NSData *))completionHandler;
-- (void)dataCompleteWithCompletionQueue:(dispatch_queue_t)queue completionHandler:(void (^)(NEFilterSourceStatus, NSData *))completionHandler;
-@property (readonly) NEFilterSourceStatus status;
-@property (readonly) NSURL *url;
-@property (readonly) NEFilterSourceDirection direction;
-@property (readonly) uint64_t socketIdentifier;
-@end
-#endif
-
+#import "NEFilterSourceSPI.h"
 SOFT_LINK_FRAMEWORK(NetworkExtension);
 SOFT_LINK_CLASS(NetworkExtension, NEFilterSource);
+#endif
 
-#endif // HAVE(NE_FILTER_SOURCE)
+SOFT_LINK_PRIVATE_FRAMEWORK(WebContentAnalysis);
+SOFT_LINK_CLASS(WebContentAnalysis, WebFilterEvaluator);
 
 namespace WebCore {
 
diff --git a/Source/WebCore/platform/spi/cocoa/NEFilterSourceSPI.h b/Source/WebCore/platform/spi/cocoa/NEFilterSourceSPI.h
new file mode 100644 (file)
index 0000000..7e0b512
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#import <NetworkExtension/NEFilterSource.h>
+
+#else
+
+typedef NS_ENUM(NSInteger, NEFilterSourceStatus) {
+    NEFilterSourceStatusPass = 1,
+    NEFilterSourceStatusBlock = 2,
+    NEFilterSourceStatusNeedsMoreData = 3,
+    NEFilterSourceStatusError = 4,
+};
+
+typedef NS_ENUM(NSInteger, NEFilterSourceDirection) {
+    NEFilterSourceDirectionOutbound = 1,
+    NEFilterSourceDirectionInbound = 2,
+};
+
+@interface NEFilterSource : NSObject
+@end
+
+@interface NEFilterSource (Details)
++ (BOOL)filterRequired;
+- (id)initWithURL:(NSURL *)url direction:(NEFilterSourceDirection)direction socketIdentifier:(uint64_t)socketIdentifier;
+- (void)addData:(NSData *)data withCompletionQueue:(dispatch_queue_t)queue completionHandler:(void (^)(NEFilterSourceStatus, NSData *))completionHandler;
+- (void)dataCompleteWithCompletionQueue:(dispatch_queue_t)queue completionHandler:(void (^)(NEFilterSourceStatus, NSData *))completionHandler;
+@property (readonly) NEFilterSourceStatus status;
+@property (readonly) NSURL *url;
+@property (readonly) NEFilterSourceDirection direction;
+@property (readonly) uint64_t socketIdentifier;
+@end
+
+#endif
diff --git a/Source/WebCore/platform/spi/cocoa/WebFilterEvaluatorSPI.h b/Source/WebCore/platform/spi/cocoa/WebFilterEvaluatorSPI.h
new file mode 100644 (file)
index 0000000..68597a0
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#import <WebContentAnalysis/WebFilterEvaluator.h>
+
+#else
+
+enum {
+    kWFEStateBuffering = 2
+};
+
+@interface WebFilterEvaluator : NSObject
+@end
+
+@interface WebFilterEvaluator (Details)
++ (BOOL)isManagedSession;
+- (BOOL)wasBlocked;
+- (NSData *)addData:(NSData *)receivedData;
+- (NSData *)dataComplete;
+- (OSStatus)filterState;
+- (id)initWithResponse:(NSURLResponse *)response;
+@end
+
+#endif