Move knowledge of PDF/PostScript MIME types into MIMETypeRegistry
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 May 2013 23:46:55 +0000 (23:46 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 May 2013 23:46:55 +0000 (23:46 +0000)
commit3cb8faee6c2ded2f5dab62a7c65c365bf0cf2438
tree5ca50f1e029c7a371ba6a75b65640470b7ce5eaa
parent9d5167ac78dcec877512fd493c50fb00477809b2
Move knowledge of PDF/PostScript MIME types into MIMETypeRegistry
https://bugs.webkit.org/show_bug.cgi?id=115487

Reviewed by Darin Adler.

No new tests, just a refactoring.

* UIProcess/WebContext.cpp:
* UIProcess/WebContext.h:
Remove pdfAndPostScriptMIMETypes.

* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::canShowMIMEType): Move PDF bits to WebPageProxy.
(WebKit::WebFrameProxy::isDisplayingPDFDocument):
Make use of WebCore's newfound knowledge of PDF and PostScript MIME types,
so we don't have to duplicate it unnecessarily in WebKit2.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::canShowMIMEType):
Add code which used to be in WebFrameProxy::canShowMIMEType, and adapt it
to use WebCore's knowledge of PDF and PostScript MIME types.

* WebProcess/Plugins/PDF/SimplePDFPlugin.mm:
(WebKit::SimplePDFPlugin::pluginInfo):
We previously supported the "text/pdf" MIME type for PDFViewController,
so SimplePDFPlugin and PDFPlugin should support it as well.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::createPlugin):
Adopt MIMETypeRegistry::isPDFOrPostScriptMIMEType.

* WebProcess/WebPage/WebPage.h:
(WebPage):
Remove pdfAndPostScriptMIMETypes.

* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::platformPreferencesDidChange):
Adopt getPDFAndPostScriptMIMETypes instead of duplicating the list in WebKit2.

* WebCore.exp.in:
Export newly-added isPDFOrPostScriptMIMEType and getPDFAndPostScriptMIMETypes.

* dom/DOMImplementation.cpp:
(WebCore::DOMImplementation::createDocument):
Adopt MIMETypeRegistry::isPDFOrPostScriptMIMEType instead of duplicating
the list of MIME types. The previous list did not include PostScript, but
it seems reasonable to put plugins ahead of built-in support for it in addition to PDF.

* platform/MIMETypeRegistry.cpp:
(WebCore::initializePDFAndPostScriptMIMETypes): Added.
(WebCore::initializeMIMETypeRegistry): Call initializePDFAndPostScriptMIMETypes.
(WebCore::MIMETypeRegistry::isPDFOrPostScriptMIMEType):
Consult our new HashSet to see if the given MIME type is one of those used for PDF or PS.

(WebCore::MIMETypeRegistry::getPDFAndPostScriptMIMETypes): Added.
* platform/MIMETypeRegistry.h:
(MIMETypeRegistry): Add isPDFOrPostScriptMIMEType and getPDFAndPostScriptMIMETypes.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@149464 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/dom/DOMImplementation.cpp
Source/WebCore/platform/MIMETypeRegistry.cpp
Source/WebCore/platform/MIMETypeRegistry.h
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/WebContext.cpp
Source/WebKit2/UIProcess/WebContext.h
Source/WebKit2/UIProcess/WebFrameProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/WebProcess/Plugins/PDF/SimplePDFPlugin.mm
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm