[QuickLook] Rename QuickLookHandle to PreviewLoader
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Mar 2017 18:11:08 +0000 (18:11 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Mar 2017 18:11:08 +0000 (18:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=169961

Reviewed by Andreas Kling.

Source/WebCore:

* WebCore.xcodeproj/project.pbxproj:
* loader/EmptyClients.cpp:
* loader/FrameLoaderClient.h:
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::isQuickLookResource):
* loader/ResourceLoader.h:
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::shouldCreatePreviewLoaderForResponse):
(WebCore::SubresourceLoader::didReceiveResponse):
(WebCore::SubresourceLoader::didReceiveData):
(WebCore::SubresourceLoader::didReceiveBuffer):
(WebCore::SubresourceLoader::didFinishLoading):
(WebCore::SubresourceLoader::didFail):
(WebCore::SubresourceLoader::shouldCreateQuickLookHandleForResponse): Deleted.
* loader/SubresourceLoader.h:
* loader/ios/PreviewLoader.h: Copied from Source/WebCore/loader/ios/QuickLook.h.
* loader/ios/PreviewLoader.mm: Added.
(testingClient):
(emptyClient):
(-[WebPreviewLoader initWithResourceLoader:resourceResponse:]):
(-[WebPreviewLoader appendDataArray:]):
(-[WebPreviewLoader finishedAppending]):
(-[WebPreviewLoader failed]):
(-[WebPreviewLoader _sendDidReceiveResponseIfNecessary]):
(-[WebPreviewLoader connection:didReceiveData:lengthReceived:]):
(-[WebPreviewLoader connectionDidFinishLoading:]):
(isQuickLookPasswordError):
(-[WebPreviewLoader connection:didFailWithError:]):
(WebCore::PreviewLoader::PreviewLoader):
(WebCore::PreviewLoader::~PreviewLoader):
(WebCore::PreviewLoader::shouldCreateForMIMEType):
(WebCore::PreviewLoader::create):
(WebCore::PreviewLoader::didReceiveData):
(WebCore::PreviewLoader::didReceiveBuffer):
(WebCore::PreviewLoader::didFinishLoading):
(WebCore::PreviewLoader::didFail):
(WebCore::PreviewLoader::setClientForTesting):
* loader/ios/QuickLook.h:
(): Deleted.
* loader/ios/QuickLook.mm:
(WebCore::QLPreviewGetSupportedMIMETypesSet):
(WebCore::removeQLPreviewConverterForURL):
(WebCore::registerQLPreviewConverterIfNeeded):
(WebCore::QLPreviewProtocol):
(WebCore::isQuickLookPreviewURL):
(qlPreviewConverterDictionaryMutex): Deleted.
(QLPreviewConverterDictionary): Deleted.
(QLContentDictionary): Deleted.
(addQLPreviewConverterWithFileForURL): Deleted.
(createQLPreviewProtocol): Deleted.
(testingClient): Deleted.
(emptyClient): Deleted.
(-[WebPreviewLoader initWithResourceLoader:resourceResponse:quickLookHandle:]): Deleted.
(-[WebPreviewLoader appendDataArray:]): Deleted.
(-[WebPreviewLoader finishedAppending]): Deleted.
(-[WebPreviewLoader failed]): Deleted.
(-[WebPreviewLoader _sendDidReceiveResponseIfNecessary]): Deleted.
(-[WebPreviewLoader connection:didReceiveData:lengthReceived:]): Deleted.
(-[WebPreviewLoader connectionDidFinishLoading:]): Deleted.
(isQuickLookPasswordError): Deleted.
(-[WebPreviewLoader connection:didFailWithError:]): Deleted.
(WebCore::QuickLookHandle::QuickLookHandle): Deleted.
(WebCore::QuickLookHandle::~QuickLookHandle): Deleted.
(WebCore::QuickLookHandle::shouldCreateForMIMEType): Deleted.
(WebCore::QuickLookHandle::create): Deleted.
(WebCore::QuickLookHandle::didReceiveData): Deleted.
(WebCore::QuickLookHandle::didReceiveBuffer): Deleted.
(WebCore::QuickLookHandle::didFinishLoading): Deleted.
(WebCore::QuickLookHandle::didFail): Deleted.
(WebCore::QuickLookHandle::setClientForTesting): Deleted.
* platform/network/ResourceHandle.h:
* platform/network/ios/PreviewLoaderClient.h: Renamed from Source/WebCore/platform/network/ios/QuickLookHandleClient.h.
(WebCore::PreviewLoaderClient::~PreviewLoaderClient):
* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::setQuickLookPassword):
* testing/MockPreviewLoaderClient.cpp: Renamed from Source/WebCore/testing/MockQuickLookHandleClient.cpp.
(WebCore::MockPreviewLoaderClient::singleton):
(WebCore::MockPreviewLoaderClient::didRequestPassword):
* testing/MockPreviewLoaderClient.h: Renamed from Source/WebCore/testing/MockQuickLookHandleClient.h.

Source/WebKit/mac:

* WebCoreSupport/WebFrameLoaderClient.h:
* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::createPreviewLoaderClient):
(WebFrameLoaderClient::createQuickLookHandleClient): Deleted.

Source/WebKit2:

* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
* WebProcess/WebCoreSupport/ios/WebFrameLoaderClientIOS.mm:
(WebKit::WebFrameLoaderClient::createPreviewLoaderClient):
(WebKit::WebFrameLoaderClient::createQuickLookHandleClient): Deleted.
* WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.cpp: Renamed from Source/WebKit2/WebProcess/WebCoreSupport/ios/WebQuickLookHandleClient.cpp.
(WebKit::WebPreviewLoaderClient::WebPreviewLoaderClient):
(WebKit::WebPreviewLoaderClient::~WebPreviewLoaderClient):
(WebKit::WebPreviewLoaderClient::didReceiveDataArray):
(WebKit::WebPreviewLoaderClient::didFinishLoading):
(WebKit::WebPreviewLoaderClient::didFail):
(WebKit::WebPreviewLoaderClient::didRequestPassword):
(WebKit::WebPreviewLoaderClient::didReceivePassword):
* WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.h: Renamed from Source/WebKit2/WebProcess/WebCoreSupport/ios/WebQuickLookHandleClient.h.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::didReceivePasswordForQuickLookDocument):

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

27 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/loader/EmptyClients.cpp
Source/WebCore/loader/FrameLoaderClient.h
Source/WebCore/loader/ResourceLoader.cpp
Source/WebCore/loader/ResourceLoader.h
Source/WebCore/loader/SubresourceLoader.cpp
Source/WebCore/loader/SubresourceLoader.h
Source/WebCore/loader/ios/PreviewLoader.h [new file with mode: 0644]
Source/WebCore/loader/ios/PreviewLoader.mm [new file with mode: 0644]
Source/WebCore/loader/ios/QuickLook.h
Source/WebCore/loader/ios/QuickLook.mm
Source/WebCore/platform/network/ResourceHandle.h
Source/WebCore/platform/network/ios/PreviewLoaderClient.h [moved from Source/WebCore/platform/network/ios/QuickLookHandleClient.h with 89% similarity]
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/MockPreviewLoaderClient.cpp [moved from Source/WebCore/testing/MockQuickLookHandleClient.cpp with 86% similarity]
Source/WebCore/testing/MockPreviewLoaderClient.h [moved from Source/WebCore/testing/MockQuickLookHandleClient.h with 84% similarity]
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h
Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
Source/WebKit2/ChangeLog
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
Source/WebKit2/WebProcess/WebCoreSupport/ios/WebFrameLoaderClientIOS.mm
Source/WebKit2/WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.cpp [moved from Source/WebKit2/WebProcess/WebCoreSupport/ios/WebQuickLookHandleClient.cpp with 84% similarity]
Source/WebKit2/WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.h [moved from Source/WebKit2/WebProcess/WebCoreSupport/ios/WebQuickLookHandleClient.h with 78% similarity]
Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

index 1cf348f..58a50ed 100644 (file)
@@ -1,3 +1,91 @@
+2017-03-22  Andy Estes  <aestes@apple.com>
+
+        [QuickLook] Rename QuickLookHandle to PreviewLoader
+        https://bugs.webkit.org/show_bug.cgi?id=169961
+
+        Reviewed by Andreas Kling.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * loader/EmptyClients.cpp:
+        * loader/FrameLoaderClient.h:
+        * loader/ResourceLoader.cpp:
+        (WebCore::ResourceLoader::isQuickLookResource):
+        * loader/ResourceLoader.h:
+        * loader/SubresourceLoader.cpp:
+        (WebCore::SubresourceLoader::shouldCreatePreviewLoaderForResponse):
+        (WebCore::SubresourceLoader::didReceiveResponse):
+        (WebCore::SubresourceLoader::didReceiveData):
+        (WebCore::SubresourceLoader::didReceiveBuffer):
+        (WebCore::SubresourceLoader::didFinishLoading):
+        (WebCore::SubresourceLoader::didFail):
+        (WebCore::SubresourceLoader::shouldCreateQuickLookHandleForResponse): Deleted.
+        * loader/SubresourceLoader.h:
+        * loader/ios/PreviewLoader.h: Copied from Source/WebCore/loader/ios/QuickLook.h.
+        * loader/ios/PreviewLoader.mm: Added.
+        (testingClient):
+        (emptyClient):
+        (-[WebPreviewLoader initWithResourceLoader:resourceResponse:]):
+        (-[WebPreviewLoader appendDataArray:]):
+        (-[WebPreviewLoader finishedAppending]):
+        (-[WebPreviewLoader failed]):
+        (-[WebPreviewLoader _sendDidReceiveResponseIfNecessary]):
+        (-[WebPreviewLoader connection:didReceiveData:lengthReceived:]):
+        (-[WebPreviewLoader connectionDidFinishLoading:]):
+        (isQuickLookPasswordError):
+        (-[WebPreviewLoader connection:didFailWithError:]):
+        (WebCore::PreviewLoader::PreviewLoader):
+        (WebCore::PreviewLoader::~PreviewLoader):
+        (WebCore::PreviewLoader::shouldCreateForMIMEType):
+        (WebCore::PreviewLoader::create):
+        (WebCore::PreviewLoader::didReceiveData):
+        (WebCore::PreviewLoader::didReceiveBuffer):
+        (WebCore::PreviewLoader::didFinishLoading):
+        (WebCore::PreviewLoader::didFail):
+        (WebCore::PreviewLoader::setClientForTesting):
+        * loader/ios/QuickLook.h:
+        (): Deleted.
+        * loader/ios/QuickLook.mm:
+        (WebCore::QLPreviewGetSupportedMIMETypesSet):
+        (WebCore::removeQLPreviewConverterForURL):
+        (WebCore::registerQLPreviewConverterIfNeeded):
+        (WebCore::QLPreviewProtocol):
+        (WebCore::isQuickLookPreviewURL):
+        (qlPreviewConverterDictionaryMutex): Deleted.
+        (QLPreviewConverterDictionary): Deleted.
+        (QLContentDictionary): Deleted.
+        (addQLPreviewConverterWithFileForURL): Deleted.
+        (createQLPreviewProtocol): Deleted.
+        (testingClient): Deleted.
+        (emptyClient): Deleted.
+        (-[WebPreviewLoader initWithResourceLoader:resourceResponse:quickLookHandle:]): Deleted.
+        (-[WebPreviewLoader appendDataArray:]): Deleted.
+        (-[WebPreviewLoader finishedAppending]): Deleted.
+        (-[WebPreviewLoader failed]): Deleted.
+        (-[WebPreviewLoader _sendDidReceiveResponseIfNecessary]): Deleted.
+        (-[WebPreviewLoader connection:didReceiveData:lengthReceived:]): Deleted.
+        (-[WebPreviewLoader connectionDidFinishLoading:]): Deleted.
+        (isQuickLookPasswordError): Deleted.
+        (-[WebPreviewLoader connection:didFailWithError:]): Deleted.
+        (WebCore::QuickLookHandle::QuickLookHandle): Deleted.
+        (WebCore::QuickLookHandle::~QuickLookHandle): Deleted.
+        (WebCore::QuickLookHandle::shouldCreateForMIMEType): Deleted.
+        (WebCore::QuickLookHandle::create): Deleted.
+        (WebCore::QuickLookHandle::didReceiveData): Deleted.
+        (WebCore::QuickLookHandle::didReceiveBuffer): Deleted.
+        (WebCore::QuickLookHandle::didFinishLoading): Deleted.
+        (WebCore::QuickLookHandle::didFail): Deleted.
+        (WebCore::QuickLookHandle::setClientForTesting): Deleted.
+        * platform/network/ResourceHandle.h:
+        * platform/network/ios/PreviewLoaderClient.h: Renamed from Source/WebCore/platform/network/ios/QuickLookHandleClient.h.
+        (WebCore::PreviewLoaderClient::~PreviewLoaderClient):
+        * testing/Internals.cpp:
+        (WebCore::Internals::resetToConsistentState):
+        (WebCore::Internals::setQuickLookPassword):
+        * testing/MockPreviewLoaderClient.cpp: Renamed from Source/WebCore/testing/MockQuickLookHandleClient.cpp.
+        (WebCore::MockPreviewLoaderClient::singleton):
+        (WebCore::MockPreviewLoaderClient::didRequestPassword):
+        * testing/MockPreviewLoaderClient.h: Renamed from Source/WebCore/testing/MockQuickLookHandleClient.h.
+
 2017-03-22  Romain Bellessort  <romain.bellessort@crf.canon.fr>
 
         [Readable Streams API] Implement ReadableStreamBYOBRequest respond() (readable stream state)
index a689ed6..969506f 100644 (file)
                A10BB5851484E3A700B2E87A /* RenderSVGRect.h in Headers */ = {isa = PBXBuildFile; fileRef = A10BB5831484E3A700B2E87A /* RenderSVGRect.h */; };
                A10BB58B1484E3B300B2E87A /* RenderSVGShape.h in Headers */ = {isa = PBXBuildFile; fileRef = A10BB5891484E3B300B2E87A /* RenderSVGShape.h */; };
                A10D7FEC1C2676D100C6C115 /* CFNetworkConnectionCacheSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A10D7FEB1C2676D100C6C115 /* CFNetworkConnectionCacheSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               A10DBF4718F92317000D70C6 /* QuickLookHandleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A10DBF4618F92317000D70C6 /* QuickLookHandleClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               A10DBF4718F92317000D70C6 /* PreviewLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A10DBF4618F92317000D70C6 /* PreviewLoaderClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A10DC76A14747BAB005E2471 /* StyleGridData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A10DC76814747BAB005E2471 /* StyleGridData.cpp */; };
                A10DC76B14747BAB005E2471 /* StyleGridData.h in Headers */ = {isa = PBXBuildFile; fileRef = A10DC76914747BAB005E2471 /* StyleGridData.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A110DB9B14F5DF7700A03B93 /* StyleGridItemData.h in Headers */ = {isa = PBXBuildFile; fileRef = A110DB9A14F5DF7700A03B93 /* StyleGridItemData.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A12A1050166444FD008FA311 /* GridTrackSize.h in Headers */ = {isa = PBXBuildFile; fileRef = A12A104E166444DC008FA311 /* GridTrackSize.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A136A00C1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A136A00A1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp */; };
                A136A00D1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.h in Headers */ = {isa = PBXBuildFile; fileRef = A136A00B1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.h */; };
-               A140618B1E2ECA0A0032B34E /* MockQuickLookHandleClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A14061891E2ECA0A0032B34E /* MockQuickLookHandleClient.cpp */; };
-               A140618C1E2ECA0A0032B34E /* MockQuickLookHandleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A140618A1E2ECA0A0032B34E /* MockQuickLookHandleClient.h */; };
+               A140618B1E2ECA0A0032B34E /* MockPreviewLoaderClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A14061891E2ECA0A0032B34E /* MockPreviewLoaderClient.cpp */; };
+               A140618C1E2ECA0A0032B34E /* MockPreviewLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A140618A1E2ECA0A0032B34E /* MockPreviewLoaderClient.h */; };
                A14090FB1AA51E1D0091191A /* ContentFilterUnblockHandlerCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = A14090FA1AA51E1D0091191A /* ContentFilterUnblockHandlerCocoa.mm */; };
                A14090FD1AA51E480091191A /* ContentFilterUnblockHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = A14090FC1AA51E480091191A /* ContentFilterUnblockHandler.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A14832B0187F618D00DA63A6 /* WAKAppKitStubs.h in Headers */ = {isa = PBXBuildFile; fileRef = A148328C187F508700DA63A6 /* WAKAppKitStubs.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 */; };
                A182D5B71BE722670087A7CC /* SettingsCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = A182D5B61BE722620087A7CC /* SettingsCocoa.mm */; };
+               A185B4291E8211A100DC9118 /* PreviewLoader.mm in Sources */ = {isa = PBXBuildFile; fileRef = A185B4271E8211A100DC9118 /* PreviewLoader.mm */; };
+               A185B42A1E8211A100DC9118 /* PreviewLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = A185B4281E8211A100DC9118 /* PreviewLoader.h */; };
                A18890AE1AA13F250026C301 /* ParentalControlsContentFilter.mm in Sources */ = {isa = PBXBuildFile; fileRef = A18890AC1AA13F250026C301 /* ParentalControlsContentFilter.mm */; };
                A18890AF1AA13F250026C301 /* ParentalControlsContentFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A18890AD1AA13F250026C301 /* ParentalControlsContentFilter.h */; };
                A19AEA211AAA808600B52B25 /* JSMockContentFilterSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = A19AEA1E1AAA806E00B52B25 /* JSMockContentFilterSettings.h */; };
                A10BB5881484E3B300B2E87A /* RenderSVGShape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGShape.cpp; sourceTree = "<group>"; };
                A10BB5891484E3B300B2E87A /* RenderSVGShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGShape.h; sourceTree = "<group>"; };
                A10D7FEB1C2676D100C6C115 /* CFNetworkConnectionCacheSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFNetworkConnectionCacheSPI.h; sourceTree = "<group>"; };
-               A10DBF4618F92317000D70C6 /* QuickLookHandleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuickLookHandleClient.h; sourceTree = "<group>"; };
+               A10DBF4618F92317000D70C6 /* PreviewLoaderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PreviewLoaderClient.h; sourceTree = "<group>"; };
                A10DC76814747BAB005E2471 /* StyleGridData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleGridData.cpp; sourceTree = "<group>"; };
                A10DC76914747BAB005E2471 /* StyleGridData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleGridData.h; sourceTree = "<group>"; };
                A110DB9A14F5DF7700A03B93 /* StyleGridItemData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleGridItemData.h; sourceTree = "<group>"; };
                A12A104E166444DC008FA311 /* GridTrackSize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GridTrackSize.h; sourceTree = "<group>"; };
                A136A00A1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLHttpRequestProgressEventThrottle.cpp; sourceTree = "<group>"; };
                A136A00B1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLHttpRequestProgressEventThrottle.h; sourceTree = "<group>"; };
-               A14061891E2ECA0A0032B34E /* MockQuickLookHandleClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MockQuickLookHandleClient.cpp; sourceTree = "<group>"; };
-               A140618A1E2ECA0A0032B34E /* MockQuickLookHandleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockQuickLookHandleClient.h; sourceTree = "<group>"; };
+               A14061891E2ECA0A0032B34E /* MockPreviewLoaderClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MockPreviewLoaderClient.cpp; sourceTree = "<group>"; };
+               A140618A1E2ECA0A0032B34E /* MockPreviewLoaderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockPreviewLoaderClient.h; sourceTree = "<group>"; };
                A14090FA1AA51E1D0091191A /* ContentFilterUnblockHandlerCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ContentFilterUnblockHandlerCocoa.mm; sourceTree = "<group>"; };
                A14090FC1AA51E480091191A /* ContentFilterUnblockHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentFilterUnblockHandler.h; sourceTree = "<group>"; };
                A148328C187F508700DA63A6 /* WAKAppKitStubs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WAKAppKitStubs.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>"; };
                A182D5B61BE722620087A7CC /* SettingsCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SettingsCocoa.mm; sourceTree = "<group>"; };
+               A185B4271E8211A100DC9118 /* PreviewLoader.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PreviewLoader.mm; sourceTree = "<group>"; };
+               A185B4281E8211A100DC9118 /* PreviewLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PreviewLoader.h; sourceTree = "<group>"; };
                A18890AC1AA13F250026C301 /* ParentalControlsContentFilter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ParentalControlsContentFilter.mm; sourceTree = "<group>"; };
                A18890AD1AA13F250026C301 /* ParentalControlsContentFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParentalControlsContentFilter.h; sourceTree = "<group>"; };
                A19AEA1C1AAA7C4900B52B25 /* MockContentFilterSettings.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = MockContentFilterSettings.idl; sourceTree = "<group>"; };
                                2D6F3E8C1C1ECB1C0061DBD4 /* MockPageOverlay.idl */,
                                2DAAE32C19DCAF6000E002D2 /* MockPageOverlayClient.cpp */,
                                2DAAE32D19DCAF6000E002D2 /* MockPageOverlayClient.h */,
-                               A14061891E2ECA0A0032B34E /* MockQuickLookHandleClient.cpp */,
-                               A140618A1E2ECA0A0032B34E /* MockQuickLookHandleClient.h */,
+                               A14061891E2ECA0A0032B34E /* MockPreviewLoaderClient.cpp */,
+                               A140618A1E2ECA0A0032B34E /* MockPreviewLoaderClient.h */,
                                EB081CD81696084400553730 /* TypeConversions.h */,
                                EB081CD91696084400553730 /* TypeConversions.idl */,
                                E1BA67191742BEF400C20251 /* WebCoreTestShimLibrary.cpp */,
                                443F04260E75C8FB007E5407 /* NetworkStateNotifierIOS.mm */,
                                A1C150781E3F2B3E0032C98C /* PreviewConverter.h */,
                                A1C150771E3F2B3E0032C98C /* PreviewConverter.mm */,
-                               A10DBF4618F92317000D70C6 /* QuickLookHandleClient.h */,
+                               A10DBF4618F92317000D70C6 /* PreviewLoaderClient.h */,
                                7E428CE413E3407F003B661C /* ResourceHandleIOS.mm */,
                                7E7DE201195CEFCD0035363B /* ResourceRequestIOS.mm */,
                                44A20DB80F84166C00B3E1FE /* WebCoreURLResponseIOS.h */,
                A15E31F01E0CB075004B371C /* ios */ = {
                        isa = PBXGroup;
                        children = (
+                               A185B4281E8211A100DC9118 /* PreviewLoader.h */,
+                               A185B4271E8211A100DC9118 /* PreviewLoader.mm */,
                                A15E31F11E0CB0AA004B371C /* QuickLook.h */,
                                A15E31F21E0CB0AA004B371C /* QuickLook.mm */,
                        );
                                4157EBFB1E3AB67F00AC9FE9 /* MockLibWebRTCPeerConnection.h in Headers */,
                                2D6F3E911C1ECB2F0061DBD4 /* MockPageOverlay.h in Headers */,
                                2D97F04819DD4140001EE9C3 /* MockPageOverlayClient.h in Headers */,
-                               A140618C1E2ECA0A0032B34E /* MockQuickLookHandleClient.h in Headers */,
+                               A140618C1E2ECA0A0032B34E /* MockPreviewLoaderClient.h in Headers */,
                                AA5F3B8D16CC33D100455EB0 /* PlatformSpeechSynthesizerMock.h in Headers */,
                                A1763F3F1E205234001D58DE /* WebArchiveDumpSupport.h in Headers */,
                                41815C1F138319830057AAA4 /* WebCoreTestSupport.h in Headers */,
                                2EDEF1F5121B0EFC00726DB2 /* BlobRegistry.h in Headers */,
                                2EDEF1F7121B0EFC00726DB2 /* BlobRegistryImpl.h in Headers */,
                                2EB4BCD3121F03E300EC4885 /* BlobResourceHandle.h in Headers */,
+                               A185B42A1E8211A100DC9118 /* PreviewLoader.h in Headers */,
                                976D6C7F122B8A3D001FD1F7 /* BlobURL.h in Headers */,
                                BC5EB5E10E81BE8700B25965 /* BorderData.h in Headers */,
                                589556ED18D4A44000764B03 /* BorderEdge.h in Headers */,
                                550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */,
                                CE12523D1A1676CD00864480 /* QuartzCoreSPI.h in Headers */,
                                A15E31F41E0CB0B5004B371C /* QuickLook.h in Headers */,
-                               A10DBF4718F92317000D70C6 /* QuickLookHandleClient.h in Headers */,
+                               A10DBF4718F92317000D70C6 /* PreviewLoaderClient.h in Headers */,
                                937F4CCC1A2D48C100BB39F5 /* QuickLookMacSPI.h in Headers */,
                                443918001A91B2F8006E04F2 /* QuickLookSoftLink.h in Headers */,
                                CE1252391A166FA000864480 /* QuickLookSPI.h in Headers */,
                                4157EBFA1E3AB67900AC9FE9 /* MockLibWebRTCPeerConnection.cpp in Sources */,
                                2D6F3E901C1ECB270061DBD4 /* MockPageOverlay.cpp in Sources */,
                                2D97F04719DD413C001EE9C3 /* MockPageOverlayClient.cpp in Sources */,
-                               A140618B1E2ECA0A0032B34E /* MockQuickLookHandleClient.cpp in Sources */,
+                               A140618B1E2ECA0A0032B34E /* MockPreviewLoaderClient.cpp in Sources */,
                                AA5F3B8F16CC4B3900455EB0 /* PlatformSpeechSynthesizerMock.cpp in Sources */,
                                A1763F3E1E205234001D58DE /* WebArchiveDumpSupport.mm in Sources */,
                                41815C1E138319830057AAA4 /* WebCoreTestSupport.cpp in Sources */,
                                947949331E0459FA00018D85 /* JSDeprecatedCSSOMRect.cpp in Sources */,
                                947949351E0459FA00018D85 /* JSDeprecatedCSSOMRGBColor.cpp in Sources */,
                                947949371E0459FA00018D85 /* JSDeprecatedCSSOMValue.cpp in Sources */,
+                               A185B4291E8211A100DC9118 /* PreviewLoader.mm in Sources */,
                                947949391E0459FA00018D85 /* JSDeprecatedCSSOMValueList.cpp in Sources */,
                                31FB1A65120A5D3F00DC02A0 /* JSDeviceMotionEvent.cpp in Sources */,
                                59A86006119DAF7F00DEF1EF /* JSDeviceOrientationEvent.cpp in Sources */,
index 8c0aa65..723042f 100644 (file)
@@ -68,7 +68,7 @@
 #endif
 
 #if USE(QUICK_LOOK)
-#include "QuickLookHandleClient.h"
+#include "PreviewLoaderClient.h"
 #endif
 
 namespace WebCore {
@@ -448,7 +448,7 @@ class EmptyFrameLoaderClient final : public FrameLoaderClient {
     void prefetchDNS(const String&) final { }
 
 #if USE(QUICK_LOOK)
-    RefPtr<QuickLookHandleClient> createQuickLookHandleClient(const String&, const String&) final { return nullptr; }
+    RefPtr<PreviewLoaderClient> createPreviewLoaderClient(const String&, const String&) final { return nullptr; }
 #endif
 };
 
index 66e386e..7b639d3 100644 (file)
@@ -83,8 +83,8 @@ class NavigationAction;
 class Page;
 class PluginViewBase;
 class PolicyChecker;
+class PreviewLoaderClient;
 class ProtectionSpace;
-class QuickLookHandleClient;
 class RTCPeerConnectionHandler;
 class ResourceError;
 class ResourceHandle;
@@ -342,7 +342,7 @@ public:
     virtual bool isEmptyFrameLoaderClient() { return false; }
 
 #if USE(QUICK_LOOK)
-    virtual RefPtr<QuickLookHandleClient> createQuickLookHandleClient(const String&, const String&) = 0;
+    virtual RefPtr<PreviewLoaderClient> createPreviewLoaderClient(const String&, const String&) = 0;
 #endif
 
 #if ENABLE(CONTENT_FILTERING)
index d65f3bf..4d85ea0 100644 (file)
@@ -57,7 +57,7 @@
 
 #if USE(QUICK_LOOK)
 #include "PreviewConverter.h"
-#include "QuickLook.h"
+#include "PreviewLoader.h"
 #endif
 
 namespace WebCore {
@@ -748,7 +748,7 @@ void ResourceLoader::unschedule(SchedulePair& pair)
 #if USE(QUICK_LOOK)
 bool ResourceLoader::isQuickLookResource() const
 {
-    return !!m_quickLookHandle;
+    return !!m_previewLoader;
 }
 #endif
 
index 5a5ec14..b559d1a 100644 (file)
@@ -51,7 +51,7 @@ class DocumentLoader;
 class Frame;
 class FrameLoader;
 class NetworkLoadMetrics;
-class QuickLookHandle;
+class PreviewLoader;
 class URL;
 
 class ResourceLoader : public RefCounted<ResourceLoader>, protected ResourceHandleClient {
@@ -175,7 +175,7 @@ protected:
     ResourceResponse m_response;
     LoadTiming m_loadTiming;
 #if USE(QUICK_LOOK)
-    std::unique_ptr<QuickLookHandle> m_quickLookHandle;
+    std::unique_ptr<PreviewLoader> m_previewLoader;
 #endif
 
 private:
index fd60262..8ba561c 100644 (file)
@@ -60,7 +60,7 @@
 #endif
 
 #if USE(QUICK_LOOK)
-#include "QuickLook.h"
+#include "PreviewLoader.h"
 #endif
 
 namespace WebCore {
@@ -261,15 +261,15 @@ void SubresourceLoader::didSendData(unsigned long long bytesSent, unsigned long
 
 #if USE(QUICK_LOOK)
 
-bool SubresourceLoader::shouldCreateQuickLookHandleForResponse(const ResourceResponse& response) const
+bool SubresourceLoader::shouldCreatePreviewLoaderForResponse(const ResourceResponse& response) const
 {
     if (m_resource->type() != CachedResource::MainResource)
         return false;
 
-    if (m_quickLookHandle)
+    if (m_previewLoader)
         return false;
 
-    return QuickLookHandle::shouldCreateForMIMEType(response.mimeType());
+    return PreviewLoader::shouldCreateForMIMEType(response.mimeType());
 }
 
 #endif
@@ -280,8 +280,8 @@ void SubresourceLoader::didReceiveResponse(const ResourceResponse& response)
     ASSERT(m_state == Initialized);
 
 #if USE(QUICK_LOOK)
-    if (shouldCreateQuickLookHandleForResponse(response)) {
-        m_quickLookHandle = QuickLookHandle::create(*this, response);
+    if (shouldCreatePreviewLoaderForResponse(response)) {
+        m_previewLoader = PreviewLoader::create(*this, response);
         return;
     }
 #endif
@@ -367,8 +367,8 @@ void SubresourceLoader::didReceiveResponse(const ResourceResponse& response)
 void SubresourceLoader::didReceiveData(const char* data, unsigned length, long long encodedDataLength, DataPayloadType dataPayloadType)
 {
 #if USE(QUICK_LOOK)
-    if (auto quickLookHandle = m_quickLookHandle.get()) {
-        if (quickLookHandle->didReceiveData(data, length))
+    if (auto previewLoader = m_previewLoader.get()) {
+        if (previewLoader->didReceiveData(data, length))
             return;
     }
 #endif
@@ -379,8 +379,8 @@ void SubresourceLoader::didReceiveData(const char* data, unsigned length, long l
 void SubresourceLoader::didReceiveBuffer(Ref<SharedBuffer>&& buffer, long long encodedDataLength, DataPayloadType dataPayloadType)
 {
 #if USE(QUICK_LOOK)
-    if (auto quickLookHandle = m_quickLookHandle.get()) {
-        if (quickLookHandle->didReceiveBuffer(buffer.get()))
+    if (auto previewLoader = m_previewLoader.get()) {
+        if (previewLoader->didReceiveBuffer(buffer.get()))
             return;
     }
 #endif
@@ -524,8 +524,8 @@ bool SubresourceLoader::checkRedirectionCrossOriginAccessControl(const ResourceR
 void SubresourceLoader::didFinishLoading(const NetworkLoadMetrics& networkLoadMetrics)
 {
 #if USE(QUICK_LOOK)
-    if (auto quickLookHandle = m_quickLookHandle.get()) {
-        if (quickLookHandle->didFinishLoading())
+    if (auto previewLoader = m_previewLoader.get()) {
+        if (previewLoader->didFinishLoading())
             return;
     }
 #endif
@@ -578,8 +578,8 @@ void SubresourceLoader::didFinishLoading(const NetworkLoadMetrics& networkLoadMe
 void SubresourceLoader::didFail(const ResourceError& error)
 {
 #if USE(QUICK_LOOK)
-    if (auto quickLookHandle = m_quickLookHandle.get())
-        quickLookHandle->didFail();
+    if (auto previewLoader = m_previewLoader.get())
+        previewLoader->didFail();
 #endif
 
     if (m_state != Initialized)
index 828aa9b..74930e2 100644 (file)
@@ -106,7 +106,7 @@ private:
 #endif
 
 #if USE(QUICK_LOOK)
-    bool shouldCreateQuickLookHandleForResponse(const ResourceResponse&) const;
+    bool shouldCreatePreviewLoaderForResponse(const ResourceResponse&) const;
 #endif
 
     enum SubresourceLoaderState {
diff --git a/Source/WebCore/loader/ios/PreviewLoader.h b/Source/WebCore/loader/ios/PreviewLoader.h
new file mode 100644 (file)
index 0000000..0e535b9
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2009-2017 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.
+ */
+
+#pragma once
+
+#include <wtf/Forward.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/RetainPtr.h>
+
+OBJC_CLASS WebPreviewLoader;
+
+namespace WebCore {
+
+class PreviewLoaderClient;
+class ResourceLoader;
+class ResourceResponse;
+class SharedBuffer;
+
+class PreviewLoader {
+    WTF_MAKE_NONCOPYABLE(PreviewLoader);
+public:
+    static bool shouldCreateForMIMEType(const String&);
+    static std::unique_ptr<PreviewLoader> create(ResourceLoader&, const ResourceResponse&);
+    ~PreviewLoader();
+
+    bool didReceiveData(const char* data, unsigned length);
+    bool didReceiveBuffer(const SharedBuffer&);
+    bool didFinishLoading();
+    void didFail();
+
+    WEBCORE_EXPORT static void setClientForTesting(RefPtr<PreviewLoaderClient>&&);
+
+private:
+    friend std::unique_ptr<PreviewLoader> std::make_unique<PreviewLoader>(ResourceLoader&, const ResourceResponse&);
+    PreviewLoader(ResourceLoader&, const ResourceResponse&);
+
+    RetainPtr<WebPreviewLoader> m_previewLoader;
+    bool m_finishedLoadingDataIntoConverter { false };
+};
+
+} // namespace WebCore
diff --git a/Source/WebCore/loader/ios/PreviewLoader.mm b/Source/WebCore/loader/ios/PreviewLoader.mm
new file mode 100644 (file)
index 0000000..061152f
--- /dev/null
@@ -0,0 +1,247 @@
+/*
+ * Copyright (C) 2009-2017 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.
+ */
+
+#import "config.h"
+#import "PreviewLoader.h"
+
+#if USE(QUICK_LOOK)
+
+#import "DocumentLoader.h"
+#import "FrameLoader.h"
+#import "FrameLoaderClient.h"
+#import "Logging.h"
+#import "PreviewConverter.h"
+#import "PreviewLoaderClient.h"
+#import "QuickLook.h"
+#import "QuickLookSPI.h"
+#import "ResourceLoader.h"
+#import <wtf/NeverDestroyed.h>
+
+using namespace WebCore;
+
+@interface WebPreviewLoader : NSObject {
+    RefPtr<ResourceLoader> _resourceLoader;
+    ResourceResponse _response;
+    RefPtr<PreviewLoaderClient> _client;
+    std::unique_ptr<PreviewConverter> _converter;
+    RetainPtr<NSMutableArray> _bufferedDataArray;
+    BOOL _hasSentDidReceiveResponse;
+}
+
+- (instancetype)initWithResourceLoader:(ResourceLoader&)resourceLoader resourceResponse:(const ResourceResponse&)resourceResponse;
+- (void)appendDataArray:(NSArray<NSData *> *)dataArray;
+- (void)finishedAppending;
+- (void)failed;
+
+@end
+
+@implementation WebPreviewLoader
+
+static RefPtr<PreviewLoaderClient>& testingClient()
+{
+    static NeverDestroyed<RefPtr<PreviewLoaderClient>> testingClient;
+    return testingClient.get();
+}
+
+static PreviewLoaderClient& emptyClient()
+{
+    static NeverDestroyed<PreviewLoaderClient> emptyClient;
+    return emptyClient.get();
+}
+
+- (instancetype)initWithResourceLoader:(ResourceLoader&)resourceLoader resourceResponse:(const ResourceResponse&)resourceResponse
+{
+    self = [super init];
+    if (!self)
+        return nil;
+
+    _resourceLoader = &resourceLoader;
+    _response = resourceResponse;
+    _converter = std::make_unique<PreviewConverter>(self, _response);
+    _bufferedDataArray = adoptNS([[NSMutableArray alloc] init]);
+
+    if (testingClient())
+        _client = testingClient();
+    else if (auto client = resourceLoader.frameLoader()->client().createPreviewLoaderClient(_converter->previewFileName(), _converter->previewUTI()))
+        _client = WTFMove(client);
+    else
+        _client = &emptyClient();
+
+    LOG(Network, "WebPreviewConverter created with preview file name \"%s\".", _converter->previewFileName().utf8().data());
+    return self;
+}
+
+- (void)appendDataArray:(NSArray<NSData *> *)dataArray
+{
+    LOG(Network, "WebPreviewConverter appending data array with count %ld.", dataArray.count);
+    [_converter->platformConverter() appendDataArray:dataArray];
+    [_bufferedDataArray addObjectsFromArray:dataArray];
+    _client->didReceiveDataArray((CFArrayRef)dataArray);
+}
+
+- (void)finishedAppending
+{
+    LOG(Network, "WebPreviewConverter finished appending data.");
+    [_converter->platformConverter() finishedAppendingData];
+    _client->didFinishLoading();
+}
+
+- (void)failed
+{
+    LOG(Network, "WebPreviewConverter failed.");
+    [_converter->platformConverter() finishConverting];
+    _client->didFail();
+}
+
+- (void)_sendDidReceiveResponseIfNecessary
+{
+    if (_hasSentDidReceiveResponse)
+        return;
+
+    [_bufferedDataArray removeAllObjects];
+
+    ResourceResponse response { _converter->previewResponse() };
+    response.setIsQuickLook(true);
+    ASSERT(response.mimeType().length());
+
+    _resourceLoader->documentLoader()->setPreviewConverter(WTFMove(_converter));
+
+    _hasSentDidReceiveResponse = YES;
+    _resourceLoader->didReceiveResponse(response);
+}
+
+- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data lengthReceived:(long long)lengthReceived
+{
+    ASSERT_UNUSED(connection, !connection);
+    [self _sendDidReceiveResponseIfNecessary];
+
+    // QuickLook code sends us a nil data at times. The check below is the same as the one in
+    // ResourceHandleMac.cpp added for a different bug.
+    if (auto dataLength = data.length)
+        _resourceLoader->didReceiveData(reinterpret_cast<const char*>(data.bytes), dataLength, lengthReceived, DataPayloadBytes);
+}
+
+- (void)connectionDidFinishLoading:(NSURLConnection *)connection
+{
+    ASSERT_UNUSED(connection, !connection);
+    ASSERT(_hasSentDidReceiveResponse);
+
+    NetworkLoadMetrics emptyMetrics;
+    _resourceLoader->didFinishLoading(emptyMetrics);
+}
+
+static inline bool isQuickLookPasswordError(NSError *error)
+{
+    return error.code == kQLReturnPasswordProtected && [error.domain isEqualToString:@"QuickLookErrorDomain"];
+}
+
+- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
+{
+    ASSERT_UNUSED(connection, !connection);
+
+    if (!isQuickLookPasswordError(error)) {
+        [self _sendDidReceiveResponseIfNecessary];
+        _resourceLoader->didFail(error);
+        return;
+    }
+
+    if (!_client->supportsPasswordEntry()) {
+        _resourceLoader->didFail(_resourceLoader->cannotShowURLError());
+        return;
+    }
+
+    _client->didRequestPassword([self, retainedSelf = retainPtr(self)] (const String& password) {
+        _converter = std::make_unique<PreviewConverter>(self, _response, password);
+        [_converter->platformConverter() appendDataArray:_bufferedDataArray.get()];
+        [_converter->platformConverter() finishedAppendingData];
+    });
+}
+
+@end
+
+namespace WebCore {
+
+PreviewLoader::PreviewLoader(ResourceLoader& loader, const ResourceResponse& response)
+    : m_previewLoader { adoptNS([[WebPreviewLoader alloc] initWithResourceLoader:loader resourceResponse:response]) }
+{
+}
+
+PreviewLoader::~PreviewLoader()
+{
+}
+
+bool PreviewLoader::shouldCreateForMIMEType(const String& mimeType)
+{
+    return [QLPreviewGetSupportedMIMETypesSet() containsObject:mimeType];
+}
+
+std::unique_ptr<PreviewLoader> PreviewLoader::create(ResourceLoader& loader, const ResourceResponse& response)
+{
+    ASSERT(shouldCreateForMIMEType(response.mimeType()));
+    return std::make_unique<PreviewLoader>(loader, response);
+}
+
+bool PreviewLoader::didReceiveData(const char* data, unsigned length)
+{
+    if (m_finishedLoadingDataIntoConverter)
+        return false;
+
+    [m_previewLoader appendDataArray:@[ [NSData dataWithBytes:data length:length] ]];
+    return true;
+}
+
+bool PreviewLoader::didReceiveBuffer(const SharedBuffer& buffer)
+{
+    if (m_finishedLoadingDataIntoConverter)
+        return false;
+
+    [m_previewLoader appendDataArray:buffer.createNSDataArray().get()];
+    return true;
+}
+
+bool PreviewLoader::didFinishLoading()
+{
+    if (m_finishedLoadingDataIntoConverter)
+        return false;
+
+    m_finishedLoadingDataIntoConverter = true;
+    [m_previewLoader finishedAppending];
+    return true;
+}
+
+void PreviewLoader::didFail()
+{
+    [m_previewLoader failed];
+    m_previewLoader = nullptr;
+}
+
+void PreviewLoader::setClientForTesting(RefPtr<PreviewLoaderClient>&& client)
+{
+    testingClient() = WTFMove(client);
+}
+
+} // namespace WebCore
+
+#endif // USE(QUICK_LOOK)
index 7d593c1..0de64b5 100644 (file)
@@ -25,9 +25,6 @@
 
 #pragma once
 
-#if USE(QUICK_LOOK)
-
-#include <wtf/Forward.h>
 #include <wtf/RetainPtr.h>
 
 OBJC_CLASS NSData;
@@ -35,15 +32,9 @@ OBJC_CLASS NSSet;
 OBJC_CLASS NSString;
 OBJC_CLASS NSURL;
 OBJC_CLASS NSURLRequest;
-OBJC_CLASS WebPreviewLoader;
 
 namespace WebCore {
 
-class QuickLookHandleClient;
-class ResourceLoader;
-class ResourceRequest;
-class ResourceResponse;
-class SharedBuffer;
 class URL;
 
 WEBCORE_EXPORT NSSet *QLPreviewGetSupportedMIMETypesSet();
@@ -53,28 +44,4 @@ WEBCORE_EXPORT const char* QLPreviewProtocol();
 WEBCORE_EXPORT bool isQuickLookPreviewURL(const URL&);
 WEBCORE_EXPORT NSString *createTemporaryFileForQuickLook(NSString *fileName);
 
-class QuickLookHandle {
-    WTF_MAKE_NONCOPYABLE(QuickLookHandle);
-public:
-    static bool shouldCreateForMIMEType(const String&);
-    static std::unique_ptr<QuickLookHandle> create(ResourceLoader&, const ResourceResponse&);
-    ~QuickLookHandle();
-
-    bool didReceiveData(const char* data, unsigned length);
-    bool didReceiveBuffer(const SharedBuffer&);
-    bool didFinishLoading();
-    void didFail();
-
-    WEBCORE_EXPORT static void setClientForTesting(RefPtr<QuickLookHandleClient>&&);
-
-private:
-    friend std::unique_ptr<QuickLookHandle> std::make_unique<QuickLookHandle>(ResourceLoader&, const ResourceResponse&);
-    QuickLookHandle(ResourceLoader&, const ResourceResponse&);
-
-    RetainPtr<WebPreviewLoader> m_previewLoader;
-    bool m_finishedLoadingDataIntoConverter { false };
-};
-
 } // namespace WebCore
-
-#endif // USE(QUICK_LOOK)
index b0e55fe..be053f7 100644 (file)
 
 #if USE(QUICK_LOOK)
 
-#import "DocumentLoader.h"
 #import "FileSystemIOS.h"
-#import "FrameLoader.h"
-#import "FrameLoaderClient.h"
-#import "Logging.h"
 #import "NSFileManagerSPI.h"
 #import "PreviewConverter.h"
-#import "QuickLookHandleClient.h"
-#import "ResourceError.h"
-#import "ResourceLoader.h"
 #import "ResourceRequest.h"
 #import "SchemeRegistry.h"
-#import "SharedBuffer.h"
-#import <WebCore/NetworkLoadMetrics.h>
+#import <wtf/Lock.h>
 #import <wtf/NeverDestroyed.h>
-#import <wtf/Vector.h>
-#import <wtf/text/WTFString.h>
 
 #import "QuickLookSoftLink.h"
 
-using namespace WebCore;
+namespace WebCore {
 
-NSSet *WebCore::QLPreviewGetSupportedMIMETypesSet()
+NSSet *QLPreviewGetSupportedMIMETypesSet()
 {
     static NeverDestroyed<RetainPtr<NSSet>> set = QLPreviewGetSupportedMIMETypes();
     return set.get().get();
@@ -74,7 +64,7 @@ static NSMutableDictionary *QLContentDictionary()
     return contentDictionary;
 }
 
-void WebCore::removeQLPreviewConverterForURL(NSURL *url)
+void removeQLPreviewConverterForURL(NSURL *url)
 {
     LockHolder lock(qlPreviewConverterDictionaryMutex());
     [QLPreviewConverterDictionary() removeObjectForKey:url];
@@ -90,7 +80,7 @@ static void addQLPreviewConverterWithFileForURL(NSURL *url, id converter, NSStri
     [QLContentDictionary() setObject:(fileName ? fileName : @"") forKey:url];
 }
 
-RetainPtr<NSURLRequest> WebCore::registerQLPreviewConverterIfNeeded(NSURL *url, NSString *mimeType, NSData *data)
+RetainPtr<NSURLRequest> registerQLPreviewConverterIfNeeded(NSURL *url, NSString *mimeType, NSData *data)
 {
     RetainPtr<NSString> updatedMIMEType = adoptNS(QLTypeCopyBestMimeTypeForURLAndMimeType(url, mimeType));
 
@@ -118,13 +108,13 @@ static Vector<char> createQLPreviewProtocol()
     return previewProtocol;
 }
 
-const char* WebCore::QLPreviewProtocol()
+const char* QLPreviewProtocol()
 {
     static NeverDestroyed<Vector<char>> previewProtocol(createQLPreviewProtocol());
     return previewProtocol.get().data();
 }
 
-bool WebCore::isQuickLookPreviewURL(const URL& url)
+bool isQuickLookPreviewURL(const URL& url)
 {
     // Use some known protocols as a short-cut to avoid loading the QuickLook framework.
     if (url.protocolIsInHTTPFamily() || url.isBlankURL() || url.protocolIsBlob() || url.protocolIsData() || SchemeRegistry::shouldTreatURLSchemeAsLocal(url.protocol().toString()))
@@ -132,152 +122,6 @@ bool WebCore::isQuickLookPreviewURL(const URL& url)
     return url.protocolIs(QLPreviewProtocol());
 }
 
-static RefPtr<QuickLookHandleClient>& testingClient()
-{
-    static NeverDestroyed<RefPtr<QuickLookHandleClient>> testingClient;
-    return testingClient.get();
-}
-
-static QuickLookHandleClient& emptyClient()
-{
-    static NeverDestroyed<QuickLookHandleClient> emptyClient;
-    return emptyClient.get();
-}
-
-@interface WebPreviewLoader : NSObject {
-    RefPtr<ResourceLoader> _resourceLoader;
-    ResourceResponse _response;
-    QuickLookHandle* _handle;
-    RefPtr<QuickLookHandleClient> _client;
-    std::unique_ptr<PreviewConverter> _converter;
-    RetainPtr<NSMutableArray> _bufferedDataArray;
-    BOOL _hasSentDidReceiveResponse;
-}
-
-- (instancetype)initWithResourceLoader:(ResourceLoader&)resourceLoader resourceResponse:(const ResourceResponse&)resourceResponse quickLookHandle:(QuickLookHandle&)quickLookHandle;
-- (void)appendDataArray:(NSArray<NSData *> *)dataArray;
-- (void)finishedAppending;
-- (void)failed;
-
-@end
-
-@implementation WebPreviewLoader
-
-- (instancetype)initWithResourceLoader:(ResourceLoader&)resourceLoader resourceResponse:(const ResourceResponse&)resourceResponse quickLookHandle:(QuickLookHandle&)quickLookHandle
-{
-    self = [super init];
-    if (!self)
-        return nil;
-
-    _resourceLoader = &resourceLoader;
-    _response = resourceResponse;
-    _handle = &quickLookHandle;
-    _converter = std::make_unique<PreviewConverter>(self, _response);
-    _bufferedDataArray = adoptNS([[NSMutableArray alloc] init]);
-
-    if (testingClient())
-        _client = testingClient();
-    else if (auto client = resourceLoader.frameLoader()->client().createQuickLookHandleClient(_converter->previewFileName(), _converter->previewUTI()))
-        _client = WTFMove(client);
-    else
-        _client = &emptyClient();
-
-    LOG(Network, "WebPreviewConverter created with preview file name \"%s\".", _converter->previewFileName().utf8().data());
-    return self;
-}
-
-- (void)appendDataArray:(NSArray<NSData *> *)dataArray
-{
-    LOG(Network, "WebPreviewConverter appending data array with count %ld.", dataArray.count);
-    [_converter->platformConverter() appendDataArray:dataArray];
-    [_bufferedDataArray addObjectsFromArray:dataArray];
-    _client->didReceiveDataArray((CFArrayRef)dataArray);
-}
-
-- (void)finishedAppending
-{
-    LOG(Network, "WebPreviewConverter finished appending data.");
-    [_converter->platformConverter() finishedAppendingData];
-    _client->didFinishLoading();
-}
-
-- (void)failed
-{
-    LOG(Network, "WebPreviewConverter failed.");
-    [_converter->platformConverter() finishConverting];
-    _client->didFail();
-}
-
-- (void)_sendDidReceiveResponseIfNecessary
-{
-    if (_hasSentDidReceiveResponse)
-        return;
-
-    [_bufferedDataArray removeAllObjects];
-
-    ResourceResponse response { _converter->previewResponse() };
-    response.setIsQuickLook(true);
-    ASSERT(response.mimeType().length());
-
-    _resourceLoader->documentLoader()->setPreviewConverter(WTFMove(_converter));
-
-    _hasSentDidReceiveResponse = YES;
-    _resourceLoader->didReceiveResponse(response);
-}
-
-- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data lengthReceived:(long long)lengthReceived
-{
-    ASSERT_UNUSED(connection, !connection);
-    [self _sendDidReceiveResponseIfNecessary];
-
-    // QuickLook code sends us a nil data at times. The check below is the same as the one in
-    // ResourceHandleMac.cpp added for a different bug.
-    if (auto dataLength = data.length)
-        _resourceLoader->didReceiveData(reinterpret_cast<const char*>(data.bytes), dataLength, lengthReceived, DataPayloadBytes);
-}
-
-- (void)connectionDidFinishLoading:(NSURLConnection *)connection
-{
-    ASSERT_UNUSED(connection, !connection);
-    ASSERT(_hasSentDidReceiveResponse);
-
-    NetworkLoadMetrics emptyMetrics;
-    _resourceLoader->didFinishLoading(emptyMetrics);
-}
-
-static inline bool isQuickLookPasswordError(NSError *error)
-{
-    return error.code == kQLReturnPasswordProtected && [error.domain isEqualToString:@"QuickLookErrorDomain"];
-}
-
-- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
-{
-    ASSERT_UNUSED(connection, !connection);
-
-    if (!isQuickLookPasswordError(error)) {
-        [self _sendDidReceiveResponseIfNecessary];
-        _resourceLoader->didFail(error);
-        return;
-    }
-
-    if (!_client->supportsPasswordEntry()) {
-        _resourceLoader->didFail(_resourceLoader->cannotShowURLError());
-        return;
-    }
-
-    _client->didRequestPassword([retainedSelf = retainPtr(self)] (const String& password) {
-        auto converter = std::make_unique<PreviewConverter>(retainedSelf.get(), retainedSelf->_response, password);
-        QLPreviewConverter *platformConverter = converter->platformConverter();
-        [platformConverter appendDataArray:retainedSelf->_bufferedDataArray.get()];
-        [platformConverter finishedAppendingData];
-        retainedSelf->_converter = WTFMove(converter);
-    });
-}
-
-@end
-
-namespace WebCore {
-
 static NSDictionary *temporaryFileAttributes()
 {
     static NSDictionary *attributes = [@{
@@ -320,65 +164,6 @@ NSString *createTemporaryFileForQuickLook(NSString *fileName)
     return contentPath;
 }
 
-QuickLookHandle::QuickLookHandle(ResourceLoader& loader, const ResourceResponse& response)
-    : m_previewLoader { adoptNS([[WebPreviewLoader alloc] initWithResourceLoader:loader resourceResponse:response quickLookHandle:*this]) }
-{
-}
-
-QuickLookHandle::~QuickLookHandle()
-{
-}
-
-bool QuickLookHandle::shouldCreateForMIMEType(const String& mimeType)
-{
-    return [QLPreviewGetSupportedMIMETypesSet() containsObject:mimeType];
-}
-
-std::unique_ptr<QuickLookHandle> QuickLookHandle::create(ResourceLoader& loader, const ResourceResponse& response)
-{
-    ASSERT(shouldCreateForMIMEType(response.mimeType()));
-    return std::make_unique<QuickLookHandle>(loader, response);
-}
-
-bool QuickLookHandle::didReceiveData(const char* data, unsigned length)
-{
-    if (m_finishedLoadingDataIntoConverter)
-        return false;
-
-    [m_previewLoader appendDataArray:@[ [NSData dataWithBytes:data length:length] ]];
-    return true;
-}
-
-bool QuickLookHandle::didReceiveBuffer(const SharedBuffer& buffer)
-{
-    if (m_finishedLoadingDataIntoConverter)
-        return false;
-
-    [m_previewLoader appendDataArray:buffer.createNSDataArray().get()];
-    return true;
-}
-
-bool QuickLookHandle::didFinishLoading()
-{
-    if (m_finishedLoadingDataIntoConverter)
-        return false;
-
-    m_finishedLoadingDataIntoConverter = true;
-    [m_previewLoader finishedAppending];
-    return true;
-}
-
-void QuickLookHandle::didFail()
-{
-    [m_previewLoader failed];
-    m_previewLoader = nullptr;
-}
-
-void QuickLookHandle::setClientForTesting(RefPtr<QuickLookHandleClient>&& client)
-{
-    testingClient() = WTFMove(client);
-}
-
-}
+} // namespace WebCore
 
 #endif // USE(QUICK_LOOK)
index 86e1161..da59518 100644 (file)
@@ -79,7 +79,6 @@ class Frame;
 class URL;
 class NetworkingContext;
 class ProtectionSpace;
-class QuickLookHandle;
 class ResourceError;
 class ResourceHandleClient;
 class ResourceHandleInternal;
 
 #pragma once
 
-#if USE(QUICK_LOOK)
-
-#include <CoreFoundation/CoreFoundation.h>
 #include <wtf/Function.h>
 #include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
-class QuickLookHandleClient : public RefCounted<QuickLookHandleClient> {
+class PreviewLoaderClient : public RefCounted<PreviewLoaderClient> {
 public:
-    virtual ~QuickLookHandleClient() { }
+    virtual ~PreviewLoaderClient() { }
     virtual void didReceiveDataArray(CFArrayRef) { }
     virtual void didFinishLoading() { }
     virtual void didFail() { }
@@ -45,5 +42,3 @@ public:
 };
 
 } // namespace WebCore
-
-#endif // USE(QUICK_LOOK)
index 08da8c6..4330d24 100644 (file)
 #endif
 
 #if USE(QUICK_LOOK)
-#include "MockQuickLookHandleClient.h"
-#include "QuickLook.h"
+#include "MockPreviewLoaderClient.h"
+#include "PreviewLoader.h"
 #endif
 
 using JSC::CallData;
@@ -446,8 +446,8 @@ void Internals::resetToConsistentState(Page& page)
     page.setLowPowerModeEnabledOverrideForTesting(std::nullopt);
 
 #if USE(QUICK_LOOK)
-    MockQuickLookHandleClient::singleton().setPassword("");
-    QuickLookHandle::setClientForTesting(nullptr);
+    MockPreviewLoaderClient::singleton().setPassword("");
+    PreviewLoader::setClientForTesting(nullptr);
 #endif
 }
 
@@ -3829,8 +3829,8 @@ Vector<String> Internals::accessKeyModifiers() const
 void Internals::setQuickLookPassword(const String& password)
 {
 #if USE(QUICK_LOOK)
-    auto& quickLookHandleClient = MockQuickLookHandleClient::singleton();
-    QuickLookHandle::setClientForTesting(&quickLookHandleClient);
+    auto& quickLookHandleClient = MockPreviewLoaderClient::singleton();
+    PreviewLoader::setClientForTesting(&quickLookHandleClient);
     quickLookHandleClient.setPassword(password);
 #else
     UNUSED_PARAM(password);
@@ -24,7 +24,7 @@
  */
 
 #include "config.h"
-#include "MockQuickLookHandleClient.h"
+#include "MockPreviewLoaderClient.h"
 
 #if USE(QUICK_LOOK)
 
 
 namespace WebCore {
 
-MockQuickLookHandleClient& MockQuickLookHandleClient::singleton()
+MockPreviewLoaderClient& MockPreviewLoaderClient::singleton()
 {
-    static NeverDestroyed<MockQuickLookHandleClient> sharedClient;
+    static NeverDestroyed<MockPreviewLoaderClient> sharedClient;
     return sharedClient.get();
 }
 
-void MockQuickLookHandleClient::didRequestPassword(Function<void(const String&)>&& completionHandler)
+void MockPreviewLoaderClient::didRequestPassword(Function<void(const String&)>&& completionHandler)
 {
     ASSERT(isMainThread());
     RunLoop::current().dispatch([completionHandler = WTFMove(completionHandler), password = m_password] {
 
 #pragma once
 
-#if USE(QUICK_LOOK)
-
-#include "QuickLookHandleClient.h"
+#include "PreviewLoaderClient.h"
 #include <wtf/NeverDestroyed.h>
 
 namespace WebCore {
 
-class MockQuickLookHandleClient final : public QuickLookHandleClient {
+class MockPreviewLoaderClient final : public PreviewLoaderClient {
 public:
-    static MockQuickLookHandleClient& singleton();
+    static MockPreviewLoaderClient& singleton();
 
     void setPassword(const String& password) { m_password = password; }
 
@@ -42,12 +40,10 @@ public:
     void didRequestPassword(Function<void(const String&)>&&) override;
 
 private:
-    friend class NeverDestroyed<MockQuickLookHandleClient>;
-    MockQuickLookHandleClient() = default;
+    friend class NeverDestroyed<MockPreviewLoaderClient>;
+    MockPreviewLoaderClient() = default;
 
     String m_password;
 };
 
 } // namespace WebCore
-
-#endif // USE(QUICK_LOOK)
index e302df7..f2665fd 100644 (file)
@@ -1,3 +1,15 @@
+2017-03-22  Andy Estes  <aestes@apple.com>
+
+        [QuickLook] Rename QuickLookHandle to PreviewLoader
+        https://bugs.webkit.org/show_bug.cgi?id=169961
+
+        Reviewed by Andreas Kling.
+
+        * WebCoreSupport/WebFrameLoaderClient.h:
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+        (WebFrameLoaderClient::createPreviewLoaderClient):
+        (WebFrameLoaderClient::createQuickLookHandleClient): Deleted.
+
 2017-03-21  Anders Carlsson  <andersca@apple.com>
 
         Remove bogus availability annotations from DOM SPI headers.
index 8c49517..8ae62f8 100644 (file)
@@ -246,7 +246,7 @@ private:
     bool shouldPaintBrokenImage(const WebCore::URL&) const final;
 
 #if USE(QUICK_LOOK)
-    RefPtr<WebCore::QuickLookHandleClient> createQuickLookHandleClient(const String& fileName, const String& uti) final;
+    RefPtr<WebCore::PreviewLoaderClient> createPreviewLoaderClient(const String& fileName, const String& uti) final;
 #endif
 
 #if ENABLE(CONTENT_FILTERING)
index 5377129..28345fa 100644 (file)
 
 #if USE(QUICK_LOOK)
 #import <WebCore/NSFileManagerSPI.h>
+#import <WebCore/PreviewLoaderClient.h>
 #import <WebCore/QuickLook.h>
-#import <WebCore/QuickLookHandleClient.h>
 #endif
 
 #if HAVE(APP_LINKS)
@@ -2222,9 +2222,9 @@ bool WebFrameLoaderClient::shouldLoadMediaElementURL(const URL& url) const
 #endif
 
 #if USE(QUICK_LOOK)
-RefPtr<QuickLookHandleClient> WebFrameLoaderClient::createQuickLookHandleClient(const String& fileName, const String& uti)
+RefPtr<PreviewLoaderClient> WebFrameLoaderClient::createPreviewLoaderClient(const String& fileName, const String& uti)
 {
-    class QuickLookDocumentWriter : public WebCore::QuickLookHandleClient {
+    class QuickLookDocumentWriter : public WebCore::PreviewLoaderClient {
     public:
         explicit QuickLookDocumentWriter(NSString *filePath)
             : m_filePath { filePath }
index 6678905..26a1e62 100644 (file)
@@ -1,3 +1,27 @@
+2017-03-22  Andy Estes  <aestes@apple.com>
+
+        [QuickLook] Rename QuickLookHandle to PreviewLoader
+        https://bugs.webkit.org/show_bug.cgi?id=169961
+
+        Reviewed by Andreas Kling.
+
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
+        * WebProcess/WebCoreSupport/ios/WebFrameLoaderClientIOS.mm:
+        (WebKit::WebFrameLoaderClient::createPreviewLoaderClient):
+        (WebKit::WebFrameLoaderClient::createQuickLookHandleClient): Deleted.
+        * WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.cpp: Renamed from Source/WebKit2/WebProcess/WebCoreSupport/ios/WebQuickLookHandleClient.cpp.
+        (WebKit::WebPreviewLoaderClient::WebPreviewLoaderClient):
+        (WebKit::WebPreviewLoaderClient::~WebPreviewLoaderClient):
+        (WebKit::WebPreviewLoaderClient::didReceiveDataArray):
+        (WebKit::WebPreviewLoaderClient::didFinishLoading):
+        (WebKit::WebPreviewLoaderClient::didFail):
+        (WebKit::WebPreviewLoaderClient::didRequestPassword):
+        (WebKit::WebPreviewLoaderClient::didReceivePassword):
+        * WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.h: Renamed from Source/WebKit2/WebProcess/WebCoreSupport/ios/WebQuickLookHandleClient.h.
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::didReceivePasswordForQuickLookDocument):
+
 2017-03-22  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [WK2] Add SPI to notify clients when data interaction is beginning or ending
index 9b81f98..465e46a 100644 (file)
                A1A4FE5B18DCE9FA00B5EA8A /* _WKDownload.mm in Sources */ = {isa = PBXBuildFile; fileRef = A1A4FE5818DCE9FA00B5EA8A /* _WKDownload.mm */; };
                A1A4FE5C18DCE9FA00B5EA8A /* _WKDownloadInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = A1A4FE5918DCE9FA00B5EA8A /* _WKDownloadInternal.h */; };
                A1A4FE6118DD54A400B5EA8A /* _WKDownloadDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = A1A4FE6018DD54A400B5EA8A /* _WKDownloadDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               A1C512C8190656E500448914 /* WebQuickLookHandleClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1C512C6190656E500448914 /* WebQuickLookHandleClient.cpp */; };
-               A1C512C9190656E500448914 /* WebQuickLookHandleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A1C512C7190656E500448914 /* WebQuickLookHandleClient.h */; };
+               A1C512C8190656E500448914 /* WebPreviewLoaderClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1C512C6190656E500448914 /* WebPreviewLoaderClient.cpp */; };
+               A1C512C9190656E500448914 /* WebPreviewLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A1C512C7190656E500448914 /* WebPreviewLoaderClient.h */; };
                A1D420471DB5578500BB6B0D /* WKContextMenuListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1EA02351DABFF7E0096021F /* WKContextMenuListener.cpp */; };
                A1DF631218E0B7C8003A3E2A /* DownloadClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = A1DF631018E0B7C8003A3E2A /* DownloadClient.mm */; };
                A1DF631318E0B7C8003A3E2A /* DownloadClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A1DF631118E0B7C8003A3E2A /* DownloadClient.h */; };
                A1A4FE5818DCE9FA00B5EA8A /* _WKDownload.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKDownload.mm; sourceTree = "<group>"; };
                A1A4FE5918DCE9FA00B5EA8A /* _WKDownloadInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKDownloadInternal.h; sourceTree = "<group>"; };
                A1A4FE6018DD54A400B5EA8A /* _WKDownloadDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKDownloadDelegate.h; sourceTree = "<group>"; };
-               A1C512C6190656E500448914 /* WebQuickLookHandleClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebQuickLookHandleClient.cpp; path = ios/WebQuickLookHandleClient.cpp; sourceTree = "<group>"; };
-               A1C512C7190656E500448914 /* WebQuickLookHandleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebQuickLookHandleClient.h; path = ios/WebQuickLookHandleClient.h; sourceTree = "<group>"; };
+               A1C512C6190656E500448914 /* WebPreviewLoaderClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebPreviewLoaderClient.cpp; path = ios/WebPreviewLoaderClient.cpp; sourceTree = "<group>"; };
+               A1C512C7190656E500448914 /* WebPreviewLoaderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebPreviewLoaderClient.h; path = ios/WebPreviewLoaderClient.h; sourceTree = "<group>"; };
                A1DF631018E0B7C8003A3E2A /* DownloadClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DownloadClient.mm; sourceTree = "<group>"; };
                A1DF631118E0B7C8003A3E2A /* DownloadClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DownloadClient.h; sourceTree = "<group>"; };
                A1EA02351DABFF7E0096021F /* WKContextMenuListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKContextMenuListener.cpp; sourceTree = "<group>"; };
                                2D28F3E01885CCC1004B9EAE /* WebChromeClientIOS.mm */,
                                2D28F3E21885CCC1004B9EAE /* WebEditorClientIOS.mm */,
                                2D28F3E31885CCC1004B9EAE /* WebFrameLoaderClientIOS.mm */,
-                               A1C512C6190656E500448914 /* WebQuickLookHandleClient.cpp */,
-                               A1C512C7190656E500448914 /* WebQuickLookHandleClient.h */,
+                               A1C512C6190656E500448914 /* WebPreviewLoaderClient.cpp */,
+                               A1C512C7190656E500448914 /* WebPreviewLoaderClient.h */,
                        );
                        name = ios;
                        sourceTree = "<group>";
                                BCE0E425168B7A280057E66A /* WebProcessSupplement.h in Headers */,
                                1A1E093418861D3800D2DC49 /* WebProgressTrackerClient.h in Headers */,
                                512F589D12A8838800629530 /* WebProtectionSpace.h in Headers */,
-                               A1C512C9190656E500448914 /* WebQuickLookHandleClient.h in Headers */,
+                               A1C512C9190656E500448914 /* WebPreviewLoaderClient.h in Headers */,
                                37948404150C350600E52CE9 /* WebRenderLayer.h in Headers */,
                                3760881F150413E900FC82C7 /* WebRenderObject.h in Headers */,
                                510AFFBA16542048001BA05E /* WebResourceLoader.h in Headers */,
                                BCEE7AD012817988009827DA /* WebProcessProxyMessageReceiver.cpp in Sources */,
                                1A1E093318861D3800D2DC49 /* WebProgressTrackerClient.cpp in Sources */,
                                512F589C12A8838800629530 /* WebProtectionSpace.cpp in Sources */,
-                               A1C512C8190656E500448914 /* WebQuickLookHandleClient.cpp in Sources */,
+                               A1C512C8190656E500448914 /* WebPreviewLoaderClient.cpp in Sources */,
                                37948403150C350600E52CE9 /* WebRenderLayer.cpp in Sources */,
                                3760881E150413E900FC82C7 /* WebRenderObject.cpp in Sources */,
                                510AFFB916542048001BA05E /* WebResourceLoader.cpp in Sources */,
                                1AAF08A1192681D100B6390C /* WebUserContentControllerProxy.cpp in Sources */,
                                7C361D78192803BD0036A59D /* WebUserContentControllerProxyMessageReceiver.cpp in Sources */,
                                15739BBE1B42046600D258C1 /* WebUserMediaClient.cpp in Sources */,
-                               CD6178141E6DE9A000FDA57D /* WebUserMediaClientMac.mm in Sources */,
                                83EE575B1DB7D61100C74C50 /* WebValidationMessageClient.cpp in Sources */,
                                52D5A1B71C574A0200DE34A3 /* WebVideoFullscreenManager.mm in Sources */,
                                3F418EF91887BD97002795FD /* WebVideoFullscreenManagerMessageReceiver.cpp in Sources */,
index 1be4c41..212f10f 100644 (file)
@@ -247,7 +247,7 @@ private:
     void forcePageTransitionIfNeeded() final;
 
 #if USE(QUICK_LOOK)
-    RefPtr<WebCore::QuickLookHandleClient> createQuickLookHandleClient(const String& fileName, const String& uti) final;
+    RefPtr<WebCore::PreviewLoaderClient> createPreviewLoaderClient(const String& fileName, const String& uti) final;
 #endif
 
 #if ENABLE(CONTENT_FILTERING)
index a1a0d84..537c5cd 100644 (file)
@@ -41,7 +41,7 @@
 #if USE(QUICK_LOOK)
 #import "WebFrame.h"
 #import "WebPage.h"
-#import "WebQuickLookHandleClient.h"
+#import "WebPreviewLoaderClient.h"
 #import <WebCore/QuickLook.h>
 #endif
 
@@ -66,7 +66,7 @@ RetainPtr<CFDictionaryRef> WebFrameLoaderClient::connectionProperties(DocumentLo
 }
 
 #if USE(QUICK_LOOK)
-RefPtr<QuickLookHandleClient> WebFrameLoaderClient::createQuickLookHandleClient(const String& fileName, const String& uti)
+RefPtr<PreviewLoaderClient> WebFrameLoaderClient::createPreviewLoaderClient(const String& fileName, const String& uti)
 {
     if (!m_frame->isMainFrame())
         return nullptr;
@@ -75,7 +75,7 @@ RefPtr<QuickLookHandleClient> WebFrameLoaderClient::createQuickLookHandleClient(
     if (!webPage)
         return nullptr;
 
-    return WebQuickLookHandleClient::create(fileName, uti, webPage->pageID());
+    return WebPreviewLoaderClient::create(fileName, uti, webPage->pageID());
 }
 #endif
 
@@ -24,7 +24,7 @@
  */
 
 #include "config.h"
-#include "WebQuickLookHandleClient.h"
+#include "WebPreviewLoaderClient.h"
 
 #if USE(QUICK_LOOK)
 
@@ -44,7 +44,7 @@ static PasswordCallbackMap& passwordCallbacks()
     return callbackMap.get();
 }
 
-WebQuickLookHandleClient::WebQuickLookHandleClient(const String& fileName, const String& uti, uint64_t pageID)
+WebPreviewLoaderClient::WebPreviewLoaderClient(const String& fileName, const String& uti, uint64_t pageID)
     : m_fileName { fileName }
     , m_uti { uti }
     , m_pageID { pageID }
@@ -52,12 +52,12 @@ WebQuickLookHandleClient::WebQuickLookHandleClient(const String& fileName, const
     WebProcess::singleton().send(Messages::WebPageProxy::DidStartLoadForQuickLookDocumentInMainFrame(m_fileName, m_uti), m_pageID);
 }
 
-WebQuickLookHandleClient::~WebQuickLookHandleClient()
+WebPreviewLoaderClient::~WebPreviewLoaderClient()
 {
     passwordCallbacks().remove(m_pageID);
 }
 
-void WebQuickLookHandleClient::didReceiveDataArray(CFArrayRef dataArray)
+void WebPreviewLoaderClient::didReceiveDataArray(CFArrayRef dataArray)
 {
     CFArrayApplyFunction(dataArray, CFRangeMake(0, CFArrayGetCount(dataArray)), [](const void* value, void* context) {
         ASSERT(CFGetTypeID(value) == CFDataGetTypeID());
@@ -65,25 +65,25 @@ void WebQuickLookHandleClient::didReceiveDataArray(CFArrayRef dataArray)
     }, &m_data);    
 }
 
-void WebQuickLookHandleClient::didFinishLoading()
+void WebPreviewLoaderClient::didFinishLoading()
 {
     WebProcess::singleton().send(Messages::WebPageProxy::DidFinishLoadForQuickLookDocumentInMainFrame(m_data), m_pageID);
     m_data.clear();
 }
 
-void WebQuickLookHandleClient::didFail()
+void WebPreviewLoaderClient::didFail()
 {
     m_data.clear();
 }
 
-void WebQuickLookHandleClient::didRequestPassword(Function<void(const String&)>&& completionHandler)
+void WebPreviewLoaderClient::didRequestPassword(Function<void(const String&)>&& completionHandler)
 {
     ASSERT(!passwordCallbacks().contains(m_pageID));
     passwordCallbacks().add(m_pageID, WTFMove(completionHandler));
     WebProcess::singleton().send(Messages::WebPageProxy::DidRequestPasswordForQuickLookDocumentInMainFrame(m_fileName), m_pageID);
 }
 
-void WebQuickLookHandleClient::didReceivePassword(const String& password, uint64_t pageID)
+void WebPreviewLoaderClient::didReceivePassword(const String& password, uint64_t pageID)
 {
     ASSERT(passwordCallbacks().contains(pageID));
     auto completionHandler = passwordCallbacks().take(pageID);
 
 #pragma once
 
-#if USE(QUICK_LOOK)
-
 #include "QuickLookDocumentData.h"
-#include <WebCore/QuickLookHandleClient.h>
+#include <WebCore/PreviewLoaderClient.h>
 #include <wtf/text/WTFString.h>
 
-namespace WebCore {
-class QuickLookHandle;
-}
-
 namespace WebKit {
 
 class WebFrame;
 
-class WebQuickLookHandleClient final : public WebCore::QuickLookHandleClient {
+class WebPreviewLoaderClient final : public WebCore::PreviewLoaderClient {
 public:
-    static Ref<WebQuickLookHandleClient> create(const String& fileName, const String& uti, uint64_t pageID)
+    static Ref<WebPreviewLoaderClient> create(const String& fileName, const String& uti, uint64_t pageID)
     {
-        return adoptRef(*new WebQuickLookHandleClient(fileName, uti, pageID));
+        return adoptRef(*new WebPreviewLoaderClient(fileName, uti, pageID));
     }
-    ~WebQuickLookHandleClient();
+    ~WebPreviewLoaderClient();
 
     static void didReceivePassword(const String&, uint64_t pageID);
 
 private:
-    WebQuickLookHandleClient(const String& fileName, const String& uti, uint64_t pageID);
+    WebPreviewLoaderClient(const String& fileName, const String& uti, uint64_t pageID);
     void didReceiveDataArray(CFArrayRef) override;
     void didFinishLoading() override;
     void didFail() override;
@@ -64,5 +58,3 @@ private:
 };
 
 } // namespace WebKit
-
-#endif // USE(QUICK_LOOK)
index d6c32e0..31261e2 100644 (file)
@@ -49,8 +49,8 @@
 #import "WebImage.h"
 #import "WebKitSystemInterface.h"
 #import "WebPageProxyMessages.h"
+#import "WebPreviewLoaderClient.h"
 #import "WebProcess.h"
-#import "WebQuickLookHandleClient.h"
 #import <CoreText/CTFont.h>
 #import <WebCore/Autofill.h>
 #import <WebCore/Chrome.h>
@@ -3282,7 +3282,7 @@ String WebPage::platformUserAgent(const URL&) const
 #if USE(QUICK_LOOK)
 void WebPage::didReceivePasswordForQuickLookDocument(const String& password)
 {
-    WebQuickLookHandleClient::didReceivePassword(password, m_pageID);
+    WebPreviewLoaderClient::didReceivePassword(password, m_pageID);
 }
 #endif