Changeset 57513 in webkit
- Timestamp:
- Apr 13, 2010 6:45:26 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r57512 r57513 1 2010-04-13 Stephan Aßmus <superstippi@gmx.de> 2 3 Reviewed by David Levin. 4 5 Use the Haiku MIME type data base as a fall back for unknown file extensions. 6 https://bugs.webkit.org/show_bug.cgi?id=34686 7 8 Covered by existing tests. 9 10 * platform/haiku/MIMETypeRegistryHaiku.cpp: 11 (WebCore::): 12 - fixed coding style issues 13 (WebCore::MIMETypeRegistry::getMIMETypeForExtension): 14 - fall back to the system MIME database for unknown types. 15 - return empty String as last resort, this is used 16 elsewhere as indicator for unknown types. 17 1 18 2010-04-13 Stephan Aßmus <superstippi@gmx.de> 2 19 -
trunk/WebCore/platform/haiku/MIMETypeRegistryHaiku.cpp
r56661 r57513 3 3 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 4 4 * Copyright (C) 2007 Trolltech ASA 5 * Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de> 5 6 * 6 7 * Redistribution and use in source and binary forms, with or without … … 30 31 31 32 #include "PlatformString.h" 32 33 #include <MimeType.h> 34 #include <wtf/text/CString.h> 33 35 34 36 namespace WebCore { … … 38 40 }; 39 41 40 static const ExtensionMap extensionMap 42 static const ExtensionMap extensionMap[] = { 41 43 { "bmp", "image/bmp" }, 42 44 { "gif", "image/gif" }, 43 45 { "html", "text/html" }, 44 { "ico", "image/x-icon" }, 46 { "ico", "image/x-icon" }, 45 47 { "jpeg", "image/jpeg" }, 46 48 { "jpg", "image/jpeg" }, … … 59 61 }; 60 62 61 // FIXME: Use the Haiku MIME registry 62 String MIMETypeRegistry::getMIMETypeForExtension(const String &ext) 63 String MIMETypeRegistry::getMIMETypeForExtension(const String& ext) 63 64 { 64 65 String str = ext.lower(); 65 const ExtensionMap *extMap = extensionMap; 66 67 // Try WebCore built-in types. 68 const ExtensionMap* extMap = extensionMap; 66 69 while (extMap->extension) { 67 70 if (str == extMap->extension) … … 69 72 ++extMap; 70 73 } 71 // unknown, let's just assume plain text 72 return "text/plain"; 74 75 // Try system mime database. 76 String fakeFileName("filename."); 77 fakeFileName.append(str); 78 79 BMimeType type; 80 if (BMimeType::GuessMimeType(fakeFileName.utf8().data(), &type) == B_OK) 81 return type.Type(); 82 83 // unknown 84 return String(); 73 85 } 74 86 … … 77 89 return false; 78 90 } 91 79 92 } // namespace WebCore 80 93
Note: See TracChangeset
for help on using the changeset viewer.