Changeset 180985 in webkit
- Timestamp:
- Mar 3, 2015 7:36:10 PM (9 years ago)
- Location:
- trunk/Source
- Files:
-
- 21 edited
- 1 copied
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r180984 r180985 1 2015-03-03 Andy Estes <aestes@apple.com> 2 3 [Content Filtering] Separate unblock handling into its own class 4 https://bugs.webkit.org/show_bug.cgi?id=142251 5 6 Reviewed by Andreas Kling. 7 8 Unblock handling is currently supported only for one type of content filter (WebFilterEvaluator) on one 9 platform (iOS). Having its implementation in ContentFilter is making it difficult to support other filters and 10 platforms, so let's separate unblock handling into its own class called ContentFilterUnblockHandler. 11 12 * WebCore.xcodeproj/project.pbxproj: 13 * loader/DocumentLoader.cpp: 14 (WebCore::DocumentLoader::finishedLoading): Passed a ContentFilterUnblockHandler to FrameLoaderClient::contentFilterDidBlockLoad. 15 (WebCore::DocumentLoader::dataReceived): Ditto. 16 * loader/FrameLoaderClient.h: 17 * platform/ContentFilter.h: 18 * platform/ContentFilterUnblockHandler.h: Copied from Source/WebCore/platform/ios/ContentFilterIOS.mm. 19 (WebCore::ContentFilterUnblockHandler::clear): 20 * platform/cocoa/ContentFilterUnblockHandlerCocoa.mm: Renamed from Source/WebCore/platform/ios/ContentFilterIOS.mm. 21 (WebCore::ContentFilterUnblockHandler::ContentFilterUnblockHandler): 22 (WebCore::ContentFilterUnblockHandler::encode): 23 (WebCore::ContentFilterUnblockHandler::decode): 24 (WebCore::scheme): 25 (WebCore::ContentFilterUnblockHandler::handleUnblockRequestAndDispatchIfSuccessful): 26 * platform/mac/ContentFilterMac.mm: 27 (WebCore::ContentFilter::unblockHandler): 28 (WebCore::ContentFilter::ContentFilter): Deleted. 29 (WebCore::ContentFilter::encode): Deleted. 30 (WebCore::ContentFilter::decode): Deleted. 31 1 32 2015-03-03 Alexey Proskuryakov <ap@apple.com> 2 33 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r180978 r180985 1045 1045 26FAE4CE1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26FAE4CA1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.cpp */; }; 1046 1046 26FAE4CF1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 26FAE4CB1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.h */; }; 1047 2903716516BA11BC00FEFDF0 /* ContentFilterIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2903716416BA11BC00FEFDF0 /* ContentFilterIOS.mm */; };1048 1047 2917B5611473496C0052C9D0 /* LayerFlushScheduler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2917B55E1473496C0052C9D0 /* LayerFlushScheduler.cpp */; }; 1049 1048 2917B5621473496C0052C9D0 /* LayerFlushScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = 2917B55F1473496C0052C9D0 /* LayerFlushScheduler.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1050 1049 2917B5631473496C0052C9D0 /* LayerFlushSchedulerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2917B5601473496C0052C9D0 /* LayerFlushSchedulerClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1051 1050 2917B566147349950052C9D0 /* LayerFlushSchedulerMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2917B565147349950052C9D0 /* LayerFlushSchedulerMac.cpp */; }; 1052 2919A1E916B3376600787213 /* ContentFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 2919A1E816B3376600787213 /* ContentFilter.h */; settings = {ATTRIBUTES = (Private, ); };};1051 2919A1E916B3376600787213 /* ContentFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 2919A1E816B3376600787213 /* ContentFilter.h */; }; 1053 1052 2919A1EB16B3378900787213 /* ContentFilterMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2919A1EA16B3378900787213 /* ContentFilterMac.mm */; }; 1054 1053 2934940A16C02C0700901318 /* PlatformSpeechSynthesisVoice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2527CC9316BF92EC009DDAC0 /* PlatformSpeechSynthesisVoice.cpp */; }; … … 3765 3764 A136A00C1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A136A00A1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp */; }; 3766 3765 A136A00D1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.h in Headers */ = {isa = PBXBuildFile; fileRef = A136A00B1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.h */; }; 3766 A14090FB1AA51E1D0091191A /* ContentFilterUnblockHandlerCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = A14090FA1AA51E1D0091191A /* ContentFilterUnblockHandlerCocoa.mm */; }; 3767 A14090FD1AA51E480091191A /* ContentFilterUnblockHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = A14090FC1AA51E480091191A /* ContentFilterUnblockHandler.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3767 3768 A14832B0187F618D00DA63A6 /* WAKAppKitStubs.h in Headers */ = {isa = PBXBuildFile; fileRef = A148328C187F508700DA63A6 /* WAKAppKitStubs.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3768 3769 A14832B1187F61E100DA63A6 /* WAKAppKitStubs.m in Sources */ = {isa = PBXBuildFile; fileRef = A148328D187F508700DA63A6 /* WAKAppKitStubs.m */; }; … … 8087 8088 26FAE4CA1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SynchronousResourceHandleCFURLConnectionDelegate.cpp; sourceTree = "<group>"; }; 8088 8089 26FAE4CB1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SynchronousResourceHandleCFURLConnectionDelegate.h; sourceTree = "<group>"; }; 8089 2903716416BA11BC00FEFDF0 /* ContentFilterIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ContentFilterIOS.mm; path = ios/ContentFilterIOS.mm; sourceTree = "<group>"; };8090 8090 2917B55E1473496C0052C9D0 /* LayerFlushScheduler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LayerFlushScheduler.cpp; path = ca/LayerFlushScheduler.cpp; sourceTree = "<group>"; }; 8091 8091 2917B55F1473496C0052C9D0 /* LayerFlushScheduler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LayerFlushScheduler.h; path = ca/LayerFlushScheduler.h; sourceTree = "<group>"; }; … … 10985 10985 A136A00A1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLHttpRequestProgressEventThrottle.cpp; sourceTree = "<group>"; }; 10986 10986 A136A00B1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLHttpRequestProgressEventThrottle.h; sourceTree = "<group>"; }; 10987 A14090FA1AA51E1D0091191A /* ContentFilterUnblockHandlerCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ContentFilterUnblockHandlerCocoa.mm; sourceTree = "<group>"; }; 10988 A14090FC1AA51E480091191A /* ContentFilterUnblockHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentFilterUnblockHandler.h; sourceTree = "<group>"; }; 10987 10989 A148328C187F508700DA63A6 /* WAKAppKitStubs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WAKAppKitStubs.h; path = ios/wak/WAKAppKitStubs.h; sourceTree = "<group>"; }; 10988 10990 A148328D187F508700DA63A6 /* WAKAppKitStubs.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WAKAppKitStubs.m; path = ios/wak/WAKAppKitStubs.m; sourceTree = "<group>"; }; … … 18619 18621 children = ( 18620 18622 A148328B187F506800DA63A6 /* wak */, 18621 2903716416BA11BC00FEFDF0 /* ContentFilterIOS.mm */,18622 18623 2655414B1489AA2B000DFC5D /* CursorIOS.cpp */, 18623 18624 31EAF97C121435A400E7C1BF /* DeviceMotionClientIOS.h */, … … 18692 18693 isa = PBXGroup; 18693 18694 children = ( 18695 A14090FA1AA51E1D0091191A /* ContentFilterUnblockHandlerCocoa.mm */, 18694 18696 5D8C4DBD1428222C0026CE72 /* DisplaySleepDisablerCocoa.cpp */, 18695 18697 5D8C4DBE1428222C0026CE72 /* DisplaySleepDisablerCocoa.h */, … … 21477 21479 BCC8CFCA0986CD2400140BF2 /* ColorData.gperf */, 21478 21480 2919A1E816B3376600787213 /* ContentFilter.h */, 21481 A14090FC1AA51E480091191A /* ContentFilterUnblockHandler.h */, 21479 21482 41D015C90F4B5C71004A662F /* ContentType.cpp */, 21480 21483 41D015C80F4B5C71004A662F /* ContentType.h */, … … 24180 24183 85ECBEF70AA7626900544F0B /* DOMHTMLParamElement.h in Headers */, 24181 24184 85E711C20AC5D5350053270F /* DOMHTMLParamElementInternal.h in Headers */, 24185 A14090FD1AA51E480091191A /* ContentFilterUnblockHandler.h in Headers */, 24182 24186 85183B480AA6926100F19FA3 /* DOMHTMLPreElement.h in Headers */, 24183 24187 85E711C30AC5D5350053270F /* DOMHTMLPreElementInternal.h in Headers */, … … 27421 27425 4ACBC0BE12713CBD0094F9B2 /* ClassList.cpp in Sources */, 27422 27426 BC904B760D10998F00680D32 /* ClassNodeList.cpp in Sources */, 27427 A14090FB1AA51E1D0091191A /* ContentFilterUnblockHandlerCocoa.mm in Sources */, 27423 27428 BCC0657D0F3CE1B700CD2D87 /* ClientRect.cpp in Sources */, 27424 27429 BCC065800F3CE1B700CD2D87 /* ClientRectList.cpp in Sources */, … … 27447 27452 BC5EB9800E82072500B25965 /* ContentData.cpp in Sources */, 27448 27453 57B791A314C6A62900F202D1 /* ContentDistributor.cpp in Sources */, 27449 2903716516BA11BC00FEFDF0 /* ContentFilterIOS.mm in Sources */,27450 27454 2919A1EB16B3378900787213 /* ContentFilterMac.mm in Sources */, 27451 27455 97C471DB12F925BD0086354B /* ContentSecurityPolicy.cpp in Sources */, -
trunk/Source/WebCore/loader/DocumentLoader.cpp
r179958 r180985 413 413 dataReceived(m_mainResource.get(), data, length); 414 414 415 if (m_contentFilter->didBlockData()) 416 frameLoader()->client().contentFilterDidBlockLoad(WTF::move(m_contentFilter)); 415 if (m_contentFilter->didBlockData()) { 416 frameLoader()->client().contentFilterDidBlockLoad(m_contentFilter->unblockHandler()); 417 m_contentFilter = nullptr; 418 } 417 419 } 418 420 #endif … … 875 877 loadWasBlockedBeforeFinishing = m_contentFilter->didBlockData(); 876 878 877 if (loadWasBlockedBeforeFinishing) 878 frameLoader()->client().contentFilterDidBlockLoad(WTF::move(m_contentFilter)); 879 if (loadWasBlockedBeforeFinishing) { 880 frameLoader()->client().contentFilterDidBlockLoad(m_contentFilter->unblockHandler()); 881 m_contentFilter = nullptr; 882 } 879 883 } 880 884 #endif -
trunk/Source/WebCore/loader/FrameLoaderClient.h
r179626 r180985 38 38 #include <wtf/Forward.h> 39 39 #include <wtf/Vector.h> 40 41 #if ENABLE(CONTENT_FILTERING) 42 #include "ContentFilterUnblockHandler.h" 43 #endif 40 44 41 45 #if PLATFORM(COCOA) … … 99 103 #endif 100 104 101 #if ENABLE(CONTENT_FILTERING)102 class ContentFilter;103 #endif104 105 105 typedef std::function<void (PolicyAction)> FramePolicyFunction; 106 106 … … 340 340 341 341 #if ENABLE(CONTENT_FILTERING) 342 virtual void contentFilterDidBlockLoad( std::unique_ptr<ContentFilter>) { }342 virtual void contentFilterDidBlockLoad(ContentFilterUnblockHandler) { } 343 343 #endif 344 344 }; -
trunk/Source/WebCore/platform/ContentFilter.h
r175283 r180985 29 29 #if ENABLE(CONTENT_FILTERING) 30 30 31 #include "ContentFilterUnblockHandler.h" 31 32 #include <wtf/PassRefPtr.h> 32 33 #include <wtf/RetainPtr.h> 33 34 34 #if PLATFORM(IOS)35 #include <functional>36 #endif37 38 35 #if PLATFORM(COCOA) 39 36 OBJC_CLASS NSData; 40 OBJC_CLASS NSKeyedArchiver;41 OBJC_CLASS NSKeyedUnarchiver;42 37 OBJC_CLASS WebFilterEvaluator; 43 38 #endif … … 68 63 bool didBlockData() const; 69 64 const char* getReplacementData(int& length) const; 70 71 #if PLATFORM(COCOA) 72 WEBCORE_EXPORT ContentFilter(); 73 WEBCORE_EXPORT void encode(NSKeyedArchiver *) const; 74 WEBCORE_EXPORT static bool decode(NSKeyedUnarchiver *, ContentFilter&); 75 #endif 76 77 #if PLATFORM(IOS) 78 WEBCORE_EXPORT bool handleUnblockRequestAndDispatchIfSuccessful(const ResourceRequest&, std::function<void()>); 79 #endif 65 ContentFilterUnblockHandler unblockHandler() const; 80 66 81 67 private: -
trunk/Source/WebCore/platform/ContentFilterUnblockHandler.h
r180984 r180985 1 1 /* 2 * Copyright (C) 201 3Apple Inc. All rights reserved.2 * Copyright (C) 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #i mport "config.h"27 # import "ContentFilter.h"26 #ifndef ContentFilterUnblockHandler_h 27 #define ContentFilterUnblockHandler_h 28 28 29 #if PLATFORM(IOS) &&ENABLE(CONTENT_FILTERING)29 #if ENABLE(CONTENT_FILTERING) 30 30 31 #import "ResourceRequest.h" 32 #import "WebCoreThreadRun.h" 33 #import "WebFilterEvaluatorSPI.h" 31 #include <functional> 32 #include <wtf/RetainPtr.h> 33 34 OBJC_CLASS NSKeyedArchiver; 35 OBJC_CLASS NSKeyedUnarchiver; 36 OBJC_CLASS WebFilterEvaluator; 34 37 35 38 namespace WebCore { 36 39 37 static inline const char* scheme() 38 { 39 static const char contentFilterScheme[] = "x-apple-content-filter"; 40 return contentFilterScheme; 41 } 40 class ResourceRequest; 42 41 43 bool ContentFilter::handleUnblockRequestAndDispatchIfSuccessful(const ResourceRequest& request, std::function<void()> function) 44 { 45 if (!request.url().protocolIs(scheme()))46 return false;42 class ContentFilterUnblockHandler { 43 public: 44 ContentFilterUnblockHandler() = default; 45 explicit ContentFilterUnblockHandler(WebFilterEvaluator *evaluator) : m_webFilterEvaluator { evaluator } { } 47 46 48 if (!equalIgnoringCase(request.url().host(), "unblock")) 49 return false; 47 void clear() { m_webFilterEvaluator = nullptr; } 48 WEBCORE_EXPORT void encode(NSKeyedArchiver *) const; 49 WEBCORE_EXPORT static bool decode(NSKeyedUnarchiver *, ContentFilterUnblockHandler&); 50 50 51 [m_platformContentFilter unblockWithCompletion:^(BOOL unblocked, NSError *) { 52 if (unblocked) 53 function(); 54 }]; 55 return true; 56 } 51 #if PLATFORM(IOS) 52 WEBCORE_EXPORT bool handleUnblockRequestAndDispatchIfSuccessful(const ResourceRequest&, std::function<void()>); 53 #endif 54 55 private: 56 RetainPtr<WebFilterEvaluator> m_webFilterEvaluator; 57 }; 57 58 58 59 } // namespace WebCore 59 60 60 #endif // PLATFORM(IOS) && ENABLE(CONTENT_FILTERING) 61 #endif // ENABLE(CONTENT_FILTERING) 62 63 #endif // ContentFilterUnblockHandler_h -
trunk/Source/WebCore/platform/cocoa/ContentFilterUnblockHandlerCocoa.mm
r180984 r180985 25 25 26 26 #import "config.h" 27 #import "ContentFilter .h"27 #import "ContentFilterUnblockHandler.h" 28 28 29 #if PLATFORM(IOS) &&ENABLE(CONTENT_FILTERING)29 #if ENABLE(CONTENT_FILTERING) 30 30 31 31 #import "ResourceRequest.h" 32 #import " WebCoreThreadRun.h"32 #import "SoftLinking.h" 33 33 #import "WebFilterEvaluatorSPI.h" 34 #import <objc/runtime.h> 35 36 SOFT_LINK_PRIVATE_FRAMEWORK(WebContentAnalysis); 37 SOFT_LINK_CLASS(WebContentAnalysis, WebFilterEvaluator); 34 38 35 39 namespace WebCore { 36 40 41 static NSString * const platformContentFilterKey = @"platformContentFilter"; 42 43 void ContentFilterUnblockHandler::encode(NSKeyedArchiver *archiver) const 44 { 45 if ([getWebFilterEvaluatorClass() conformsToProtocol:@protocol(NSSecureCoding)]) 46 [archiver encodeObject:m_webFilterEvaluator.get() forKey:platformContentFilterKey]; 47 } 48 49 bool ContentFilterUnblockHandler::decode(NSKeyedUnarchiver *unarchiver, ContentFilterUnblockHandler& unblockHandler) 50 { 51 @try { 52 if ([getWebFilterEvaluatorClass() conformsToProtocol:@protocol(NSSecureCoding)]) 53 unblockHandler.m_webFilterEvaluator = (WebFilterEvaluator *)[unarchiver decodeObjectOfClass:getWebFilterEvaluatorClass() forKey:platformContentFilterKey]; 54 return true; 55 } @catch (NSException *exception) { 56 LOG_ERROR("The platform content filter being decoded is not a WebFilterEvaluator."); 57 } 58 59 return false; 60 } 61 62 #if PLATFORM(IOS) 37 63 static inline const char* scheme() 38 64 { 39 static const char contentFilterScheme[] = "x-apple-content-filter"; 40 return contentFilterScheme; 65 return "x-apple-content-filter"; 41 66 } 42 67 43 bool ContentFilter ::handleUnblockRequestAndDispatchIfSuccessful(const ResourceRequest& request, std::function<void()> function)68 bool ContentFilterUnblockHandler::handleUnblockRequestAndDispatchIfSuccessful(const ResourceRequest& request, std::function<void()> function) 44 69 { 70 if (!m_webFilterEvaluator) 71 return false; 72 45 73 if (!request.url().protocolIs(scheme())) 46 74 return false; … … 49 77 return false; 50 78 51 [m_ platformContentFilter unblockWithCompletion:^(BOOL unblocked, NSError *) {79 [m_webFilterEvaluator unblockWithCompletion:^(BOOL unblocked, NSError *) { 52 80 if (unblocked) 53 81 function(); … … 55 83 return true; 56 84 } 85 #endif 57 86 58 87 } // namespace WebCore -
trunk/Source/WebCore/platform/mac/ContentFilterMac.mm
r180708 r180985 45 45 namespace WebCore { 46 46 47 ContentFilter::ContentFilter()48 #if HAVE(NE_FILTER_SOURCE)49 : m_neFilterSourceStatus(NEFilterSourceStatusNeedsMoreData)50 , m_neFilterSourceQueue(0)51 #endif52 {53 }54 55 47 ContentFilter::ContentFilter(const ResourceResponse& response) 56 48 #if HAVE(NE_FILTER_SOURCE) … … 203 195 } 204 196 205 static NSString * const platformContentFilterKey = @"platformContentFilter"; 206 207 void ContentFilter::encode(NSKeyedArchiver *archiver) const 208 { 209 if ([getWebFilterEvaluatorClass() conformsToProtocol:@protocol(NSSecureCoding)]) 210 [archiver encodeObject:m_platformContentFilter.get() forKey:platformContentFilterKey]; 211 } 212 213 bool ContentFilter::decode(NSKeyedUnarchiver *unarchiver, ContentFilter& contentFilter) 214 { 215 @try { 216 if ([getWebFilterEvaluatorClass() conformsToProtocol:@protocol(NSSecureCoding)]) 217 contentFilter.m_platformContentFilter = (WebFilterEvaluator *)[unarchiver decodeObjectOfClass:getWebFilterEvaluatorClass() forKey:platformContentFilterKey]; 218 return true; 219 } @catch (NSException *exception) { 220 LOG_ERROR("The platform content filter being decoded is not a WebFilterEvaluator."); 221 } 222 223 return false; 197 ContentFilterUnblockHandler ContentFilter::unblockHandler() const 198 { 199 return ContentFilterUnblockHandler { m_platformContentFilter.get() }; 224 200 } 225 201 -
trunk/Source/WebKit/mac/ChangeLog
r180963 r180985 1 2015-03-03 Andy Estes <aestes@apple.com> 2 3 [Content Filtering] Separate unblock handling into its own class 4 https://bugs.webkit.org/show_bug.cgi?id=142251 5 6 Reviewed by Andreas Kling. 7 8 Adopted ContentFilterUnblockHandler. 9 10 * WebCoreSupport/WebFrameLoaderClient.h: 11 * WebCoreSupport/WebFrameLoaderClient.mm: 12 (WebFrameLoaderClient::dispatchDidStartProvisionalLoad): 13 * WebView/WebFrame.mm: 14 (-[WebFrame _contentFilterDidHandleNavigationAction:]): 15 * WebView/WebFrameInternal.h: 16 1 17 2015-03-03 Chris Dumez <cdumez@apple.com> 2 18 -
trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h
r176912 r180985 240 240 #endif 241 241 242 v irtual void contentFilterDidBlockLoad(std::unique_ptr<WebCore::ContentFilter>) override;242 void contentFilterDidBlockLoad(WebCore::ContentFilterUnblockHandler) override; 243 243 244 244 RetainPtr<WebFrame> m_webFrame; -
trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
r179409 r180985 663 663 ASSERT(!m_webFrame->_private->provisionalURL); 664 664 m_webFrame->_private->provisionalURL = core(m_webFrame.get())->loader().provisionalDocumentLoader()->url().string(); 665 m_webFrame->_private->contentFilter ForBlockedLoad = nullptr;665 m_webFrame->_private->contentFilterUnblockHandler.clear(); 666 666 667 667 WebView *webView = getWebView(m_webFrame.get()); … … 2240 2240 #endif 2241 2241 2242 void WebFrameLoaderClient::contentFilterDidBlockLoad( std::unique_ptr<WebCore::ContentFilter> contentFilter)2243 { 2244 m_webFrame->_private->contentFilter ForBlockedLoad = WTF::move(contentFilter);2242 void WebFrameLoaderClient::contentFilterDidBlockLoad(WebCore::ContentFilterUnblockHandler unblockHandler) 2243 { 2244 m_webFrame->_private->contentFilterUnblockHandler = WTF::move(unblockHandler); 2245 2245 } 2246 2246 -
trunk/Source/WebKit/mac/WebView/WebFrame.mm
r180704 r180985 1006 1006 { 1007 1007 #if PLATFORM(IOS) 1008 if (ContentFilter *contentFilter = _private->contentFilterForBlockedLoad.get()) { 1009 RetainPtr<WebFrame> retainedMainFrame = [[self webView] mainFrame]; 1010 return contentFilter->handleUnblockRequestAndDispatchIfSuccessful(request, [retainedMainFrame] { 1011 WebThreadRun(^ { 1012 [retainedMainFrame reload]; 1013 }); 1008 RetainPtr<WebFrame> retainedMainFrame = [[self webView] mainFrame]; 1009 return _private->contentFilterUnblockHandler.handleUnblockRequestAndDispatchIfSuccessful(request, [retainedMainFrame] { 1010 WebThreadRun(^ { 1011 [retainedMainFrame reload]; 1014 1012 }); 1015 } 1016 #endif 1017 1013 }); 1014 #else 1018 1015 return NO; 1016 #endif 1019 1017 } 1020 1018 -
trunk/Source/WebKit/mac/WebView/WebFrameInternal.h
r177450 r180985 31 31 #import "WebFramePrivate.h" 32 32 #import "WebPreferencesPrivate.h" 33 #import <WebCore/ContentFilter .h>33 #import <WebCore/ContentFilterUnblockHandler.h> 34 34 #import <WebCore/EditAction.h> 35 35 #import <WebCore/FrameLoaderTypes.h> … … 93 93 BOOL isCommitting; 94 94 #endif 95 std::unique_ptr<WebCore::ContentFilter> contentFilterForBlockedLoad;95 WebCore::ContentFilterUnblockHandler contentFilterUnblockHandler; 96 96 } 97 97 @end -
trunk/Source/WebKit2/ChangeLog
r180982 r180985 1 2015-03-03 Andy Estes <aestes@apple.com> 2 3 [Content Filtering] Separate unblock handling into its own class 4 https://bugs.webkit.org/show_bug.cgi?id=142251 5 6 Reviewed by Andreas Kling. 7 8 Adopted ContentFilterUnblockHandler. 9 10 * Shared/WebCoreArgumentCoders.h: 11 * Shared/mac/WebCoreArgumentCodersMac.mm: 12 (IPC::ArgumentCoder<ContentFilterUnblockHandler>::encode): 13 (IPC::ArgumentCoder<ContentFilterUnblockHandler>::decode): 14 (IPC::ArgumentCoder<ContentFilter>::encode): Deleted. 15 (IPC::ArgumentCoder<ContentFilter>::decode): Deleted. 16 * UIProcess/Cocoa/WebPageProxyCocoa.mm: 17 (WebKit::WebPageProxy::contentFilterDidBlockLoadForFrame): 18 * UIProcess/WebFrameProxy.cpp: 19 (WebKit::WebFrameProxy::didStartProvisionalLoad): 20 (WebKit::WebFrameProxy::contentFilterDidHandleNavigationAction): 21 * UIProcess/WebFrameProxy.h: 22 (WebKit::WebFrameProxy::setContentFilterUnblockHandler): 23 (WebKit::WebFrameProxy::setContentFilterForBlockedLoad): Deleted. 24 * UIProcess/WebPageProxy.h: 25 * UIProcess/WebPageProxy.messages.in: 26 * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: 27 (WebKit::WebFrameLoaderClient::contentFilterDidBlockLoad): 28 * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 29 1 30 2015-03-03 Chris Dumez <cdumez@apple.com> 2 31 -
trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h
r180882 r180985 112 112 #if ENABLE(CONTENT_FILTERING) 113 113 namespace WebCore { 114 class ContentFilter ;114 class ContentFilterUnblockHandler; 115 115 } 116 116 #endif … … 444 444 445 445 #if ENABLE(CONTENT_FILTERING) 446 template<> struct ArgumentCoder<WebCore::ContentFilter > {447 static void encode(ArgumentEncoder&, const WebCore::ContentFilter &);448 static bool decode(ArgumentDecoder&, WebCore::ContentFilter &);446 template<> struct ArgumentCoder<WebCore::ContentFilterUnblockHandler> { 447 static void encode(ArgumentEncoder&, const WebCore::ContentFilterUnblockHandler&); 448 static bool decode(ArgumentDecoder&, WebCore::ContentFilterUnblockHandler&); 449 449 }; 450 450 #endif -
trunk/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm
r177593 r180985 32 32 #import "WebKitSystemInterface.h" 33 33 #import <WebCore/CertificateInfo.h> 34 #import <WebCore/ContentFilter .h>34 #import <WebCore/ContentFilterUnblockHandler.h> 35 35 #import <WebCore/Credential.h> 36 36 #import <WebCore/KeyboardEvent.h> … … 408 408 } 409 409 410 void ArgumentCoder<ContentFilter >::encode(ArgumentEncoder& encoder, const ContentFilter& contentFilter)410 void ArgumentCoder<ContentFilterUnblockHandler>::encode(ArgumentEncoder& encoder, const ContentFilterUnblockHandler& contentFilterUnblockHandler) 411 411 { 412 412 RetainPtr<NSMutableData> data = adoptNS([[NSMutableData alloc] init]); 413 413 RetainPtr<NSKeyedArchiver> archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]); 414 414 [archiver setRequiresSecureCoding:YES]; 415 contentFilter .encode(archiver.get());415 contentFilterUnblockHandler.encode(archiver.get()); 416 416 [archiver finishEncoding]; 417 417 IPC::encode(encoder, reinterpret_cast<CFDataRef>(data.get())); 418 418 } 419 419 420 bool ArgumentCoder<ContentFilter >::decode(ArgumentDecoder& decoder, ContentFilter& contentFilter)420 bool ArgumentCoder<ContentFilterUnblockHandler>::decode(ArgumentDecoder& decoder, ContentFilterUnblockHandler& contentFilterUnblockHandler) 421 421 { 422 422 RetainPtr<CFDataRef> data; … … 426 426 RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)data.get()]); 427 427 [unarchiver setRequiresSecureCoding:YES]; 428 if (!ContentFilter ::decode(unarchiver.get(), contentFilter))428 if (!ContentFilterUnblockHandler::decode(unarchiver.get(), contentFilterUnblockHandler)) 429 429 return false; 430 430 -
trunk/Source/WebKit2/UIProcess/Cocoa/WebPageProxyCocoa.mm
r174400 r180985 73 73 } 74 74 75 void WebPageProxy::contentFilterDidBlockLoadForFrame(const WebCore::ContentFilter & contentFilter, uint64_t frameID)75 void WebPageProxy::contentFilterDidBlockLoadForFrame(const WebCore::ContentFilterUnblockHandler& unblockHandler, uint64_t frameID) 76 76 { 77 77 if (WebFrameProxy* frame = m_process->webFrame(frameID)) 78 frame->setContentFilter ForBlockedLoad(std::make_unique<WebCore::ContentFilter>(contentFilter));78 frame->setContentFilterUnblockHandler(unblockHandler); 79 79 } 80 80 -
trunk/Source/WebKit2/UIProcess/WebFrameProxy.cpp
r178688 r180985 129 129 m_frameLoadState.didStartProvisionalLoad(url); 130 130 #if ENABLE(CONTENT_FILTERING) 131 m_contentFilter ForBlockedLoad = nullptr;131 m_contentFilterUnblockHandler.clear(); 132 132 #endif 133 133 } … … 238 238 { 239 239 #if PLATFORM(IOS) 240 if (m_contentFilterForBlockedLoad) {241 RefPtr<WebPageProxy> retainedPage = m_page;242 ret urn m_contentFilterForBlockedLoad->handleUnblockRequestAndDispatchIfSuccessful(request, [retainedPage] {243 retainedPage->reload(false);244 }); 245 }240 RefPtr<WebPageProxy> retainedPage = m_page; 241 return m_contentFilterUnblockHandler.handleUnblockRequestAndDispatchIfSuccessful(request, [retainedPage] { 242 retainedPage->reload(false); 243 }); 244 #else 245 return false; 246 246 #endif 247 248 return false;249 247 } 250 248 #endif -
trunk/Source/WebKit2/UIProcess/WebFrameProxy.h
r178688 r180985 37 37 38 38 #if ENABLE(CONTENT_FILTERING) 39 #include <WebCore/ContentFilter .h>39 #include <WebCore/ContentFilterUnblockHandler.h> 40 40 #endif 41 41 … … 124 124 125 125 #if ENABLE(CONTENT_FILTERING) 126 void setContentFilter ForBlockedLoad(std::unique_ptr<WebCore::ContentFilter> contentFilter) { m_contentFilterForBlockedLoad = WTF::move(contentFilter); }126 void setContentFilterUnblockHandler(WebCore::ContentFilterUnblockHandler contentFilterUnblockHandler) { m_contentFilterUnblockHandler = WTF::move(contentFilterUnblockHandler); } 127 127 bool contentFilterDidHandleNavigationAction(const WebCore::ResourceRequest&); 128 128 #endif … … 143 143 144 144 #if ENABLE(CONTENT_FILTERING) 145 std::unique_ptr<WebCore::ContentFilter> m_contentFilterForBlockedLoad;145 WebCore::ContentFilterUnblockHandler m_contentFilterUnblockHandler; 146 146 #endif 147 147 }; -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r180886 r180985 1367 1367 1368 1368 #if ENABLE(CONTENT_FILTERING) 1369 void contentFilterDidBlockLoadForFrame(const WebCore::ContentFilter &, uint64_t frameID);1369 void contentFilterDidBlockLoadForFrame(const WebCore::ContentFilterUnblockHandler&, uint64_t frameID); 1370 1370 #endif 1371 1371 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in
r180768 r180985 415 415 416 416 #if ENABLE(CONTENT_FILTERING) 417 ContentFilterDidBlockLoadForFrame(WebCore::ContentFilter contentFilter, uint64_t frameID)417 ContentFilterDidBlockLoadForFrame(WebCore::ContentFilterUnblockHandler unblockHandler, uint64_t frameID) 418 418 #endif 419 419 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
r179955 r180985 1647 1647 1648 1648 #if ENABLE(CONTENT_FILTERING) 1649 void WebFrameLoaderClient::contentFilterDidBlockLoad( std::unique_ptr<WebCore::ContentFilter> contentFilter)1649 void WebFrameLoaderClient::contentFilterDidBlockLoad(WebCore::ContentFilterUnblockHandler unblockHandler) 1650 1650 { 1651 1651 if (WebPage* webPage = m_frame->page()) 1652 webPage->send(Messages::WebPageProxy::ContentFilterDidBlockLoadForFrame( *contentFilter, m_frame->frameID()));1652 webPage->send(Messages::WebPageProxy::ContentFilterDidBlockLoadForFrame(unblockHandler, m_frame->frameID())); 1653 1653 } 1654 1654 #endif -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
r176915 r180985 233 233 234 234 #if ENABLE(CONTENT_FILTERING) 235 v irtual void contentFilterDidBlockLoad(std::unique_ptr<WebCore::ContentFilter>) override;235 void contentFilterDidBlockLoad(WebCore::ContentFilterUnblockHandler) override; 236 236 #endif 237 237
Note: See TracChangeset
for help on using the changeset viewer.