15c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)/* 25c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 35c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 45c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Redistribution and use in source and binary forms, with or without 55c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * modification, are permitted provided that the following conditions 65c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * are met: 75c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 1. Redistributions of source code must retain the above copyright 85c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * notice, this list of conditions and the following disclaimer. 95c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 2. Redistributions in binary form must reproduce the above copyright 105c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * notice, this list of conditions and the following disclaimer in the 115c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * documentation and/or other materials provided with the distribution. 125c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 135c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 145c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 155c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 165c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 175c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 185c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 195c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 205c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 215c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 225c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 235c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 245c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) */ 255c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 265c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#ifndef MIMETypeRegistry_h 275c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#define MIMETypeRegistry_h 285c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 2951b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)#include "platform/PlatformExport.h" 307757ec2eadfa2dd8ac2aeed0a4399e9b07ec38cbBen Murdoch#include "wtf/HashSet.h" 317757ec2eadfa2dd8ac2aeed0a4399e9b07ec38cbBen Murdoch#include "wtf/text/StringHash.h" 327757ec2eadfa2dd8ac2aeed0a4399e9b07ec38cbBen Murdoch#include "wtf/text/WTFString.h" 335c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 34c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)namespace blink { 355c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 3651b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)class PLATFORM_EXPORT MIMETypeRegistry { 375c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)public: 385c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) static String getMIMETypeForExtension(const String& extension); 395c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) static String getWellKnownMIMETypeForExtension(const String& extension); 405c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 415c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) static String getMIMETypeForPath(const String& path); 425c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 435c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // Check to see if a mime type is suitable for being loaded inline as an 445c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // image (e.g., <img> tags). 455c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) static bool isSupportedImageMIMEType(const String& mimeType); 465c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 475c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // Check to see if a mime type is suitable for being loaded as an image 485c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // document in a frame. 495c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) static bool isSupportedImageResourceMIMEType(const String& mimeType); 505c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 517242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci // Check to see if a mime type is suitable for being displayed as an image. 527242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci static bool isSupportedImagePrefixedMIMEType(const String& mimeType); 537242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci 545c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // Check to see if a mime type is suitable for being encoded. 555c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) static bool isSupportedImageMIMETypeForEncoding(const String& mimeType); 565c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 575c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // Check to see if a mime type is suitable for being loaded as a JavaScript 585c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // resource. 5902772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch static bool isSupportedJavaScriptMIMEType(const String& mimeType); 605c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 615c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // Check to see if a non-image mime type is suitable for being loaded as a 6251b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles) // document in a frame. Includes supported JavaScript MIME types. 635c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) static bool isSupportedNonImageMIMEType(const String& mimeType); 645c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 65926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) // Check to see if the mime type and codecs are supported by the MediaSource implementation. 66926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) static bool isSupportedMediaSourceMIMEType(const String& mimeType, const String& codecs); 67926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) 68d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) // Check to see if the key system, mime type and codecs are supported by the Encrypted Media Extensions implementation. 69d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) static bool isSupportedEncryptedMediaMIMEType(const String& keySystem, const String& mimeType, const String& codecs); 70d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 715c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // Check to see if a mime type is a valid Java applet mime type 725c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) static bool isJavaAppletMIMEType(const String& mimeType); 735c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)}; 745c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 75c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)} // namespace blink 765c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 775c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#endif // MIMETypeRegistry_h 78