OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <map> | 5 #include <map> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "net/base/mime_util.h" | 8 #include "net/base/mime_util.h" |
9 #include "net/base/platform_mime_util.h" | 9 #include "net/base/platform_mime_util.h" |
10 | 10 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 { "image/gif", "gif" }, | 83 { "image/gif", "gif" }, |
84 { "image/jpeg", "jpeg,jpg" }, | 84 { "image/jpeg", "jpeg,jpg" }, |
85 { "image/png", "png" }, | 85 { "image/png", "png" }, |
86 { "video/mp4", "mp4,m4v" }, | 86 { "video/mp4", "mp4,m4v" }, |
87 { "audio/x-m4a", "m4a" }, | 87 { "audio/x-m4a", "m4a" }, |
88 { "audio/mp3", "mp3" }, | 88 { "audio/mp3", "mp3" }, |
89 { "video/ogg", "ogv,ogm" }, | 89 { "video/ogg", "ogv,ogm" }, |
90 { "audio/ogg", "ogg,oga" }, | 90 { "audio/ogg", "ogg,oga" }, |
91 { "video/webm", "webm" }, | 91 { "video/webm", "webm" }, |
92 { "audio/webm", "webm" }, | 92 { "audio/webm", "webm" }, |
| 93 { "audio/wav", "wav" }, |
93 { "application/xhtml+xml", "xhtml,xht" }, | 94 { "application/xhtml+xml", "xhtml,xht" }, |
94 { "application/x-chrome-extension", "crx" } | 95 { "application/x-chrome-extension", "crx" } |
95 }; | 96 }; |
96 | 97 |
97 static const MimeInfo secondary_mappings[] = { | 98 static const MimeInfo secondary_mappings[] = { |
98 { "application/octet-stream", "exe,com,bin" }, | 99 { "application/octet-stream", "exe,com,bin" }, |
99 { "application/gzip", "gz" }, | 100 { "application/gzip", "gz" }, |
100 { "application/pdf", "pdf" }, | 101 { "application/pdf", "pdf" }, |
101 { "application/postscript", "ps,eps,ai" }, | 102 { "application/postscript", "ps,eps,ai" }, |
102 { "application/x-javascript", "js" }, | 103 { "application/x-javascript", "js" }, |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 201 |
201 // A list of media types: http://en.wikipedia.org/wiki/Internet_media_type | 202 // A list of media types: http://en.wikipedia.org/wiki/Internet_media_type |
202 // A comprehensive mime type list: http://plugindoc.mozdev.org/winmime.php | 203 // A comprehensive mime type list: http://plugindoc.mozdev.org/winmime.php |
203 static const char* const supported_media_types[] = { | 204 static const char* const supported_media_types[] = { |
204 // Ogg. | 205 // Ogg. |
205 "video/ogg", | 206 "video/ogg", |
206 "audio/ogg", | 207 "audio/ogg", |
207 "application/ogg", | 208 "application/ogg", |
208 "video/webm", | 209 "video/webm", |
209 "audio/webm", | 210 "audio/webm", |
| 211 "audio/wav", |
210 | 212 |
211 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS) | 213 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS) |
212 // MPEG-4. | 214 // MPEG-4. |
213 "video/mp4", | 215 "video/mp4", |
214 "video/x-m4v", | 216 "video/x-m4v", |
215 "audio/mp4", | 217 "audio/mp4", |
216 "audio/x-m4a", | 218 "audio/x-m4a", |
217 | 219 |
218 // MP3. | 220 // MP3. |
219 "audio/mp3", | 221 "audio/mp3", |
220 "audio/x-mp3", | 222 "audio/x-mp3", |
221 "audio/mpeg", | 223 "audio/mpeg", |
222 #endif | 224 #endif |
223 }; | 225 }; |
224 | 226 |
225 // List of supported codecs when passed in with <source type="...">. | 227 // List of supported codecs when passed in with <source type="...">. |
226 // | 228 // |
227 // Refer to http://wiki.whatwg.org/wiki/Video_type_parameters#Browser_Support | 229 // Refer to http://wiki.whatwg.org/wiki/Video_type_parameters#Browser_Support |
228 // for more information. | 230 // for more information. |
229 static const char* const supported_media_codecs[] = { | 231 static const char* const supported_media_codecs[] = { |
230 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS) | 232 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS) |
231 "avc1", | 233 "avc1", |
232 "mp4a", | 234 "mp4a", |
233 #endif | 235 #endif |
234 "theora", | 236 "theora", |
235 "vorbis", | 237 "vorbis", |
236 "vp8" | 238 "vp8", |
| 239 "1" // PCM for WAV. |
237 }; | 240 }; |
238 | 241 |
239 // Note: does not include javascript types list (see supported_javascript_types) | 242 // Note: does not include javascript types list (see supported_javascript_types) |
240 static const char* const supported_non_image_types[] = { | 243 static const char* const supported_non_image_types[] = { |
241 "text/cache-manifest", | 244 "text/cache-manifest", |
242 "text/html", | 245 "text/html", |
243 "text/xml", | 246 "text/xml", |
244 "text/xsl", | 247 "text/xsl", |
245 "text/plain", | 248 "text/plain", |
246 // Many users complained about css files served for | 249 // Many users complained about css files served for |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 "image/svg+xml" | 300 "image/svg+xml" |
298 }; | 301 }; |
299 | 302 |
300 struct MediaFormatStrict { | 303 struct MediaFormatStrict { |
301 const char* mime_type; | 304 const char* mime_type; |
302 const char* codecs_list; | 305 const char* codecs_list; |
303 }; | 306 }; |
304 | 307 |
305 static const MediaFormatStrict format_codec_mappings[] = { | 308 static const MediaFormatStrict format_codec_mappings[] = { |
306 { "video/webm", "vorbis,vp8,vp8.0" }, | 309 { "video/webm", "vorbis,vp8,vp8.0" }, |
307 { "audio/webm", "vorbis" } | 310 { "audio/webm", "vorbis" }, |
| 311 { "audio/wav", "1" } |
308 }; | 312 }; |
309 | 313 |
310 void MimeUtil::InitializeMimeTypeMaps() { | 314 void MimeUtil::InitializeMimeTypeMaps() { |
311 for (size_t i = 0; i < arraysize(supported_image_types); ++i) | 315 for (size_t i = 0; i < arraysize(supported_image_types); ++i) |
312 image_map_.insert(supported_image_types[i]); | 316 image_map_.insert(supported_image_types[i]); |
313 | 317 |
314 // Initialize the supported non-image types. | 318 // Initialize the supported non-image types. |
315 for (size_t i = 0; i < arraysize(supported_non_image_types); ++i) | 319 for (size_t i = 0; i < arraysize(supported_non_image_types); ++i) |
316 non_image_map_.insert(supported_non_image_types[i]); | 320 non_image_map_.insert(supported_non_image_types[i]); |
317 for (size_t i = 0; i < arraysize(supported_javascript_types); ++i) | 321 for (size_t i = 0; i < arraysize(supported_javascript_types); ++i) |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 | 705 |
702 GetExtensionsFromHardCodedMappings(secondary_mappings, | 706 GetExtensionsFromHardCodedMappings(secondary_mappings, |
703 arraysize(secondary_mappings), | 707 arraysize(secondary_mappings), |
704 mime_type, | 708 mime_type, |
705 &unique_extensions); | 709 &unique_extensions); |
706 | 710 |
707 HashSetToVector(&unique_extensions, extensions); | 711 HashSetToVector(&unique_extensions, extensions); |
708 } | 712 } |
709 | 713 |
710 } // namespace net | 714 } // namespace net |
OLD | NEW |