Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Unified Diff: Source/WebCore/fileapi/File.cpp

Issue 11370004: Revert 123677 - Merge 123495 - Files from drag and file <input> should use getMIMETypeForExtension … (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1180/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/fileapi/File.h ('k') | Source/WebCore/html/FileInputType.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « Source/WebCore/fileapi/File.h ('k') | Source/WebCore/html/FileInputType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698