Title: [251502] trunk/Source/WebCore
Revision
251502
Author
aes...@apple.com
Date
2019-10-23 15:23:52 -0700 (Wed, 23 Oct 2019)

Log Message

[Quick Look] Move PreviewConverter from platform/network/ to platform/
https://bugs.webkit.org/show_bug.cgi?id=203309

Reviewed by Tim Horton.

* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/PreviewConverter.h: Renamed from Source/WebCore/platform/network/ios/PreviewConverter.h.
* platform/ios/PreviewConverterIOS.mm: Renamed from Source/WebCore/platform/network/ios/PreviewConverter.mm.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (251501 => 251502)


--- trunk/Source/WebCore/ChangeLog	2019-10-23 22:06:46 UTC (rev 251501)
+++ trunk/Source/WebCore/ChangeLog	2019-10-23 22:23:52 UTC (rev 251502)
@@ -1,3 +1,15 @@
+2019-10-23  Andy Estes  <aes...@apple.com>
+
+        [Quick Look] Move PreviewConverter from platform/network/ to platform/
+        https://bugs.webkit.org/show_bug.cgi?id=203309
+
+        Reviewed by Tim Horton.
+
+        * SourcesCocoa.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/PreviewConverter.h: Renamed from Source/WebCore/platform/network/ios/PreviewConverter.h.
+        * platform/ios/PreviewConverterIOS.mm: Renamed from Source/WebCore/platform/network/ios/PreviewConverter.mm.
+
 2019-10-21  Jiewen Tan  <jiewen_...@apple.com>
 
         [WebAuthn] Warn users when multiple NFC tags present

Modified: trunk/Source/WebCore/SourcesCocoa.txt (251501 => 251502)


--- trunk/Source/WebCore/SourcesCocoa.txt	2019-10-23 22:06:46 UTC (rev 251501)
+++ trunk/Source/WebCore/SourcesCocoa.txt	2019-10-23 22:23:52 UTC (rev 251502)
@@ -402,6 +402,7 @@
 platform/ios/PlatformScreenIOS.mm
 platform/ios/PlatformSpeechSynthesizerIOS.mm @no-unify
 platform/ios/PlaybackSessionInterfaceAVKit.mm @no-unify
+platform/ios/PreviewConverterIOS.mm
 platform/ios/QuickLook.mm
 platform/ios/RemoteCommandListenerIOS.mm
 platform/ios/ScrollAnimatorIOS.mm
@@ -516,7 +517,6 @@
 platform/network/cocoa/WebCoreNSURLSession.mm @no-unify
 
 platform/network/ios/NetworkStateNotifierIOS.mm
-platform/network/ios/PreviewConverter.mm
 platform/network/ios/WebCoreURLResponseIOS.mm
 
 platform/network/mac/AuthenticationMac.mm

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (251501 => 251502)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-10-23 22:06:46 UTC (rev 251501)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-10-23 22:23:52 UTC (rev 251502)
@@ -11327,7 +11327,7 @@
 		A1BB85B52159B38A0067E07D /* JSMockPaymentError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMockPaymentError.h; sourceTree = "<group>"; };
 		A1BF6B801AA96C7D00AF4A8A /* MockContentFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MockContentFilter.cpp; sourceTree = "<group>"; };
 		A1BF6B811AA96C7D00AF4A8A /* MockContentFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockContentFilter.h; sourceTree = "<group>"; };
-		A1C150771E3F2B3E0032C98C /* PreviewConverter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PreviewConverter.mm; sourceTree = "<group>"; };
+		A1C150771E3F2B3E0032C98C /* PreviewConverterIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PreviewConverterIOS.mm; sourceTree = "<group>"; };
 		A1C150781E3F2B3E0032C98C /* PreviewConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PreviewConverter.h; sourceTree = "<group>"; };
 		A1C2C5751FA2851600BA46FA /* PaymentSession.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PaymentSession.cpp; sourceTree = "<group>"; };
 		A1C7FAA1133A5D3500D6732D /* JSXPathResultCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXPathResultCustom.cpp; sourceTree = "<group>"; };
@@ -18262,8 +18262,6 @@
 			children = (
 				A10DBF4618F92317000D70C6 /* LegacyPreviewLoaderClient.h */,
 				443F04260E75C8FB007E5407 /* NetworkStateNotifierIOS.mm */,
-				A1C150781E3F2B3E0032C98C /* PreviewConverter.h */,
-				A1C150771E3F2B3E0032C98C /* PreviewConverter.mm */,
 				44A20DB80F84166C00B3E1FE /* WebCoreURLResponseIOS.h */,
 				444D4E210F708B2E003158E0 /* WebCoreURLResponseIOS.mm */,
 			);
@@ -22668,6 +22666,7 @@
 				AAE3755D17429BCC006200C2 /* PlatformSpeechSynthesizerIOS.mm */,
 				CDA29A2E1CBF73FC00901CCF /* PlaybackSessionInterfaceAVKit.h */,
 				CDA29A2F1CBF73FC00901CCF /* PlaybackSessionInterfaceAVKit.mm */,
+				A1C150771E3F2B3E0032C98C /* PreviewConverterIOS.mm */,
 				A15E31F11E0CB0AA004B371C /* QuickLook.h */,
 				A15E31F21E0CB0AA004B371C /* QuickLook.mm */,
 				CDFC360118CA61630026E56F /* RemoteCommandListenerIOS.h */,
@@ -25707,6 +25706,7 @@
 				0668E1890ADD9624004128E0 /* PopupMenu.h */,
 				ABC128760B33AA6D00C693D5 /* PopupMenuClient.h */,
 				BC3BE12A0E98092F00835588 /* PopupMenuStyle.h */,
+				A1C150781E3F2B3E0032C98C /* PreviewConverter.h */,
 				51F645D21FECDBC800B54DED /* ProcessIdentifier.cpp */,
 				51F645D31FECDBC800B54DED /* ProcessIdentifier.h */,
 				F47A633C1FF6FD500081B3CC /* PromisedAttachmentInfo.h */,

Copied: trunk/Source/WebCore/platform/PreviewConverter.h (from rev 251501, trunk/Source/WebCore/platform/network/ios/PreviewConverter.h) (0 => 251502)


--- trunk/Source/WebCore/platform/PreviewConverter.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/PreviewConverter.h	2019-10-23 22:23:52 UTC (rev 251502)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 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.
+ */
+
+#include <objc/objc.h>
+#include <wtf/RetainPtr.h>
+#include <wtf/text/WTFString.h>
+
+OBJC_CLASS NSData;
+OBJC_CLASS QLPreviewConverter;
+
+namespace WebCore {
+
+class ResourceRequest;
+class ResourceResponse;
+
+class PreviewConverter {
+    WTF_MAKE_FAST_ALLOCATED;
+    WTF_MAKE_NONCOPYABLE(PreviewConverter);
+public:
+    PreviewConverter(id delegate, const ResourceResponse&, const String& password = { });
+    PreviewConverter(NSData *, const String& uti, const String& password = { });
+
+    WEBCORE_EXPORT static bool supportsMIMEType(const String& mimeType);
+
+    QLPreviewConverter *platformConverter() const { return m_platformConverter.get(); }
+    ResourceRequest safeRequest(const ResourceRequest&) const;
+    ResourceRequest previewRequest() const;
+    ResourceResponse previewResponse() const;
+    String previewFileName() const;
+    String previewUTI() const;
+
+private:
+    RetainPtr<QLPreviewConverter> m_platformConverter;
+};
+
+} // namespace WebCore

Copied: trunk/Source/WebCore/platform/ios/PreviewConverterIOS.mm (from rev 251501, trunk/Source/WebCore/platform/network/ios/PreviewConverter.mm) (0 => 251502)


--- trunk/Source/WebCore/platform/ios/PreviewConverterIOS.mm	                        (rev 0)
+++ trunk/Source/WebCore/platform/ios/PreviewConverterIOS.mm	2019-10-23 22:23:52 UTC (rev 251502)
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2017-2019 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 "PreviewConverter.h"
+
+#if USE(QUICK_LOOK)
+
+#import "QuickLook.h"
+#import "ResourceRequest.h"
+#import "ResourceResponse.h"
+#import <pal/ios/QuickLookSoftLink.h>
+#import <pal/spi/ios/QuickLookSPI.h>
+
+namespace WebCore {
+
+static NSDictionary *optionsWithPassword(const String& password)
+{
+    if (password.isNull())
+        return nil;
+
+    return @{ (NSString *)PAL::get_QuickLook_kQLPreviewOptionPasswordKey() : password };
+}
+
+PreviewConverter::PreviewConverter(id delegate, const ResourceResponse& response, const String& password)
+    : m_platformConverter { adoptNS([PAL::allocQLPreviewConverterInstance() initWithConnection:nil delegate:delegate response:response.nsURLResponse() options:optionsWithPassword(password)]) }
+{
+}
+
+PreviewConverter::PreviewConverter(NSData *data, const String& uti, const String& password)
+    : m_platformConverter { adoptNS([PAL::allocQLPreviewConverterInstance() initWithData:data name:nil uti:uti options:optionsWithPassword(password)]) }
+{
+}
+
+bool PreviewConverter::supportsMIMEType(const String& mimeType)
+{
+    if (equalLettersIgnoringASCIICase(mimeType, "text/html") || equalLettersIgnoringASCIICase(mimeType, "text/plain"))
+        return false;
+
+    static std::once_flag onceFlag;
+    static NeverDestroyed<HashSet<String, ASCIICaseInsensitiveHash>> supportedMIMETypes;
+    std::call_once(onceFlag, [] {
+        for (NSString *mimeType in QLPreviewGetSupportedMIMETypesSet())
+            supportedMIMETypes->add(mimeType);
+    });
+
+    if (mimeType.isNull())
+        return false;
+
+    return supportedMIMETypes->contains(mimeType);
+}
+
+ResourceRequest PreviewConverter::safeRequest(const ResourceRequest& request) const
+{
+    return [m_platformConverter safeRequestForRequest:request.nsURLRequest(HTTPBodyUpdatePolicy::DoNotUpdateHTTPBody)];
+}
+
+ResourceRequest PreviewConverter::previewRequest() const
+{
+    return [m_platformConverter previewRequest];
+}
+
+ResourceResponse PreviewConverter::previewResponse() const
+{
+    return [m_platformConverter previewResponse];
+}
+
+String PreviewConverter::previewFileName() const
+{
+    return [m_platformConverter previewFileName];
+}
+
+String PreviewConverter::previewUTI() const
+{
+    return [m_platformConverter previewUTI];
+}
+
+} // namespace WebCore
+
+#endif // USE(QUICK_LOOK)

Deleted: trunk/Source/WebCore/platform/network/ios/PreviewConverter.h (251501 => 251502)


--- trunk/Source/WebCore/platform/network/ios/PreviewConverter.h	2019-10-23 22:06:46 UTC (rev 251501)
+++ trunk/Source/WebCore/platform/network/ios/PreviewConverter.h	2019-10-23 22:23:52 UTC (rev 251502)
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#include <objc/objc.h>
-#include <wtf/RetainPtr.h>
-#include <wtf/text/WTFString.h>
-
-OBJC_CLASS NSData;
-OBJC_CLASS QLPreviewConverter;
-
-namespace WebCore {
-
-class ResourceRequest;
-class ResourceResponse;
-
-class PreviewConverter {
-    WTF_MAKE_FAST_ALLOCATED;
-    WTF_MAKE_NONCOPYABLE(PreviewConverter);
-public:
-    PreviewConverter(id delegate, const ResourceResponse&, const String& password = { });
-    PreviewConverter(NSData *, const String& uti, const String& password = { });
-
-    WEBCORE_EXPORT static bool supportsMIMEType(const String& mimeType);
-
-    QLPreviewConverter *platformConverter() const { return m_platformConverter.get(); }
-    ResourceRequest safeRequest(const ResourceRequest&) const;
-    ResourceRequest previewRequest() const;
-    ResourceResponse previewResponse() const;
-    String previewFileName() const;
-    String previewUTI() const;
-
-private:
-    RetainPtr<QLPreviewConverter> m_platformConverter;
-};
-
-} // namespace WebCore

Deleted: trunk/Source/WebCore/platform/network/ios/PreviewConverter.mm (251501 => 251502)


--- trunk/Source/WebCore/platform/network/ios/PreviewConverter.mm	2019-10-23 22:06:46 UTC (rev 251501)
+++ trunk/Source/WebCore/platform/network/ios/PreviewConverter.mm	2019-10-23 22:23:52 UTC (rev 251502)
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2017-2019 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 "PreviewConverter.h"
-
-#if USE(QUICK_LOOK)
-
-#import "QuickLook.h"
-#import "ResourceRequest.h"
-#import "ResourceResponse.h"
-#import <pal/ios/QuickLookSoftLink.h>
-#import <pal/spi/ios/QuickLookSPI.h>
-
-namespace WebCore {
-
-static NSDictionary *optionsWithPassword(const String& password)
-{
-    if (password.isNull())
-        return nil;
-
-    return @{ (NSString *)PAL::get_QuickLook_kQLPreviewOptionPasswordKey() : password };
-}
-
-PreviewConverter::PreviewConverter(id delegate, const ResourceResponse& response, const String& password)
-    : m_platformConverter { adoptNS([PAL::allocQLPreviewConverterInstance() initWithConnection:nil delegate:delegate response:response.nsURLResponse() options:optionsWithPassword(password)]) }
-{
-}
-
-PreviewConverter::PreviewConverter(NSData *data, const String& uti, const String& password)
-    : m_platformConverter { adoptNS([PAL::allocQLPreviewConverterInstance() initWithData:data name:nil uti:uti options:optionsWithPassword(password)]) }
-{
-}
-
-bool PreviewConverter::supportsMIMEType(const String& mimeType)
-{
-    if (equalLettersIgnoringASCIICase(mimeType, "text/html") || equalLettersIgnoringASCIICase(mimeType, "text/plain"))
-        return false;
-
-    static std::once_flag onceFlag;
-    static NeverDestroyed<HashSet<String, ASCIICaseInsensitiveHash>> supportedMIMETypes;
-    std::call_once(onceFlag, [] {
-        for (NSString *mimeType in QLPreviewGetSupportedMIMETypesSet())
-            supportedMIMETypes->add(mimeType);
-    });
-
-    if (mimeType.isNull())
-        return false;
-
-    return supportedMIMETypes->contains(mimeType);
-}
-
-ResourceRequest PreviewConverter::safeRequest(const ResourceRequest& request) const
-{
-    return [m_platformConverter safeRequestForRequest:request.nsURLRequest(HTTPBodyUpdatePolicy::DoNotUpdateHTTPBody)];
-}
-
-ResourceRequest PreviewConverter::previewRequest() const
-{
-    return [m_platformConverter previewRequest];
-}
-
-ResourceResponse PreviewConverter::previewResponse() const
-{
-    return [m_platformConverter previewResponse];
-}
-
-String PreviewConverter::previewFileName() const
-{
-    return [m_platformConverter previewFileName];
-}
-
-String PreviewConverter::previewUTI() const
-{
-    return [m_platformConverter previewUTI];
-}
-
-} // namespace WebCore
-
-#endif // USE(QUICK_LOOK)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to