Extract UTI mapping and allow for additions
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Apr 2019 23:13:44 +0000 (23:13 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Apr 2019 23:13:44 +0000 (23:13 +0000)
commited4f216bd64b867d09fa3c6ee8159b1804244f30
tree30b338bad0d505e4c00a8721b076ff6428fede13
parent2f427ac241d79cd28270aefb20b26ff019dc0c2c
Extract UTI mapping and allow for additions
https://bugs.webkit.org/show_bug.cgi?id=196822
<rdar://problem/49822339>

Reviewed by Tim Horton.

Source/WebCore:

Add an ADDITIONAL_SYSTEM_PREVIEW_TYPES macro to the list
of accepted MIME types. And add a new helper to map
MIME types to UTI types when the system was unable to
find an existing type.

* platform/MIMETypeRegistry.cpp:
(WebCore::MIMETypeRegistry::systemPreviewMIMETypes):
* platform/network/mac/UTIUtilities.mm:
(WebCore::UTIFromUnknownMIMEType):
(WebCore::UTIFromMIMETypeCachePolicy::createValueForKey):

Source/WebKit:

Use the new helper to map MIME type to UTI.

* UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
(-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
* UIProcess/ios/WKSystemPreviewView.mm:
(getUTIForSystemPreviewMIMEType):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244201 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/MIMETypeRegistry.cpp
Source/WebCore/platform/network/mac/UTIUtilities.mm
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm
Source/WebKit/UIProcess/ios/WKSystemPreviewView.mm