OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved. | 2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 18 matching lines...) Expand all Loading... |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "MIMETypeRegistry.h" | 32 #include "MIMETypeRegistry.h" |
33 | 33 |
34 #include "MediaPlayer.h" | 34 #include "MediaPlayer.h" |
35 #include "PlatformBridge.h" | 35 #include "PlatformBridge.h" |
36 #include "PluginDataChromium.h" | 36 #include "PluginDataChromium.h" |
37 #include <wtf/text/CString.h> | 37 #include <wtf/text/CString.h> |
38 | 38 |
39 // NOTE: Unlike other ports, we don't use the shared implementation bits in | 39 // NOTE: Unlike other ports, we don't use the shared implementation in |
40 // MIMETypeRegistry.cpp. Instead, we need to route most functions via the | 40 // MIMETypeRegistry.cpp. Instead, we need to route most functions via |
41 // PlatformBridge to the embedder. | 41 // the PlatformBridge to the embedder. |
42 | 42 |
43 namespace WebCore { | 43 namespace WebCore { |
44 | 44 |
45 #if ENABLE(FILE_SYSTEM) && ENABLE(WORKERS) | |
46 String MIMETypeRegistry::getMIMETypeForExtensionThreadSafe(const String &ext) | |
47 { | |
48 return PlatformBridge::mimeTypeForExtension(ext); | |
49 } | |
50 #endif | |
51 | |
52 // NOTE: We have to define getMIMETypeForExtension() here though the shared | |
53 // implementation has getMIMETypeForExtension() since we don't use the shared | |
54 // implementation bits in MIMETypeRegistry.cpp. | |
55 | |
56 String MIMETypeRegistry::getMIMETypeForExtension(const String &ext) | 45 String MIMETypeRegistry::getMIMETypeForExtension(const String &ext) |
57 { | 46 { |
58 return PlatformBridge::mimeTypeForExtension(ext); | 47 return PlatformBridge::mimeTypeForExtension(ext); |
59 } | 48 } |
60 | 49 |
| 50 #if ENABLE(FILE_SYSTEM) |
| 51 String MIMETypeRegistry::getWellKnownMIMETypeForExtension(const String &ext) |
| 52 { |
| 53 // This method must be thread safe and should not consult the OS/registry. |
| 54 return PlatformBridge::wellKnownMimeTypeForExtension(ext); |
| 55 } |
| 56 #endif |
| 57 |
61 // Returns the file extension if one is found. Does not include the dot in the | 58 // Returns the file extension if one is found. Does not include the dot in the |
62 // filename. E.g., 'html'. | 59 // filename. E.g., 'html'. |
63 String MIMETypeRegistry::getPreferredExtensionForMIMEType(const String& type) | 60 String MIMETypeRegistry::getPreferredExtensionForMIMEType(const String& type) |
64 { | 61 { |
65 // Prune out any parameters in case they happen to have snuck in there... | 62 // Prune out any parameters in case they happen to have snuck in there... |
66 // FIXME: Is this really necessary?? | 63 // FIXME: Is this really necessary?? |
67 String mimeType = type.substring(0, static_cast<unsigned>(type.find(';'))); | 64 String mimeType = type.substring(0, static_cast<unsigned>(type.find(';'))); |
68 | 65 |
69 String ext = PlatformBridge::preferredExtensionForMIMEType(type); | 66 String ext = PlatformBridge::preferredExtensionForMIMEType(type); |
70 if (!ext.isEmpty() && ext[0] == '.') | 67 if (!ext.isEmpty() && ext[0] == '.') |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 } | 150 } |
154 | 151 |
155 // NOTE: the following methods should never be reached | 152 // NOTE: the following methods should never be reached |
156 HashSet<String>& MIMETypeRegistry::getSupportedImageMIMETypes() { return dummyHa
shSet(); } | 153 HashSet<String>& MIMETypeRegistry::getSupportedImageMIMETypes() { return dummyHa
shSet(); } |
157 HashSet<String>& MIMETypeRegistry::getSupportedImageResourceMIMETypes() { return
dummyHashSet(); } | 154 HashSet<String>& MIMETypeRegistry::getSupportedImageResourceMIMETypes() { return
dummyHashSet(); } |
158 HashSet<String>& MIMETypeRegistry::getSupportedImageMIMETypesForEncoding() { ret
urn dummyHashSet(); } | 155 HashSet<String>& MIMETypeRegistry::getSupportedImageMIMETypesForEncoding() { ret
urn dummyHashSet(); } |
159 HashSet<String>& MIMETypeRegistry::getSupportedNonImageMIMETypes() { return dumm
yHashSet(); } | 156 HashSet<String>& MIMETypeRegistry::getSupportedNonImageMIMETypes() { return dumm
yHashSet(); } |
160 HashSet<String>& MIMETypeRegistry::getSupportedMediaMIMETypes() { return dummyHa
shSet(); } | 157 HashSet<String>& MIMETypeRegistry::getSupportedMediaMIMETypes() { return dummyHa
shSet(); } |
161 | 158 |
162 } // namespace WebCore | 159 } // namespace WebCore |
OLD | NEW |