| Index: Source/WebCore/fileapi/File.cpp
|
| ===================================================================
|
| --- Source/WebCore/fileapi/File.cpp (revision 133651)
|
| +++ Source/WebCore/fileapi/File.cpp (working copy)
|
| @@ -34,18 +34,12 @@
|
|
|
| namespace WebCore {
|
|
|
| -static String getContentTypeFromFileName(const String& name, File::ContentTypeLookupPolicy policy)
|
| +static String getContentTypeFromFileName(const String& name)
|
| {
|
| String type;
|
| int index = name.reverseFind('.');
|
| - if (index != -1) {
|
| - if (policy == File::WellKnownContentTypes)
|
| - type = MIMETypeRegistry::getWellKnownMIMETypeForExtension(name.substring(index + 1));
|
| - else {
|
| - ASSERT(policy == File::AllContentTypes);
|
| - type = MIMETypeRegistry::getMIMETypeForExtension(name.substring(index + 1));
|
| - }
|
| - }
|
| + if (index != -1)
|
| + type = MIMETypeRegistry::getWellKnownMIMETypeForExtension(name.substring(index + 1));
|
| return type;
|
| }
|
|
|
| @@ -57,21 +51,21 @@
|
| return blobData.release();
|
| }
|
|
|
| -static PassOwnPtr<BlobData> createBlobDataForFile(const String& path, File::ContentTypeLookupPolicy policy)
|
| +static PassOwnPtr<BlobData> createBlobDataForFile(const String& path)
|
| {
|
| - return createBlobDataForFileWithType(path, getContentTypeFromFileName(path, policy));
|
| + return createBlobDataForFileWithType(path, getContentTypeFromFileName(path));
|
| }
|
|
|
| -static PassOwnPtr<BlobData> createBlobDataForFileWithName(const String& path, const String& fileSystemName, File::ContentTypeLookupPolicy policy)
|
| +static PassOwnPtr<BlobData> createBlobDataForFileWithName(const String& path, const String& fileSystemName)
|
| {
|
| - return createBlobDataForFileWithType(path, getContentTypeFromFileName(fileSystemName, policy));
|
| + return createBlobDataForFileWithType(path, getContentTypeFromFileName(fileSystemName));
|
| }
|
|
|
| #if ENABLE(FILE_SYSTEM)
|
| static PassOwnPtr<BlobData> createBlobDataForFileWithMetadata(const String& fileSystemName, const FileMetadata& metadata)
|
| {
|
| OwnPtr<BlobData> blobData = BlobData::create();
|
| - blobData->setContentType(getContentTypeFromFileName(fileSystemName, File::WellKnownContentTypes));
|
| + blobData->setContentType(getContentTypeFromFileName(fileSystemName));
|
| blobData->appendFile(metadata.platformPath, 0, metadata.length, metadata.modificationTime);
|
| return blobData.release();
|
| }
|
| @@ -80,14 +74,14 @@
|
| #if ENABLE(DIRECTORY_UPLOAD)
|
| PassRefPtr<File> File::createWithRelativePath(const String& path, const String& relativePath)
|
| {
|
| - RefPtr<File> file = adoptRef(new File(path, AllContentTypes));
|
| + RefPtr<File> file = adoptRef(new File(path));
|
| file->m_relativePath = relativePath;
|
| return file.release();
|
| }
|
| #endif
|
|
|
| -File::File(const String& path, ContentTypeLookupPolicy policy)
|
| - : Blob(createBlobDataForFile(path, policy), -1)
|
| +File::File(const String& path)
|
| + : Blob(createBlobDataForFile(path), -1)
|
| , m_path(path)
|
| , m_name(pathGetFileName(path))
|
| #if ENABLE(FILE_SYSTEM)
|
| @@ -111,8 +105,8 @@
|
| // See SerializedScriptValue.cpp for js and v8.
|
| }
|
|
|
| -File::File(const String& path, const String& name, ContentTypeLookupPolicy policy)
|
| - : Blob(createBlobDataForFileWithName(path, name, policy), -1)
|
| +File::File(const String& path, const String& name)
|
| + : Blob(createBlobDataForFileWithName(path, name), -1)
|
| , m_path(path)
|
| , m_name(name)
|
| #if ENABLE(FILE_SYSTEM)
|
|
|