OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "net/base/mime_util.h" | 7 #include "net/base/mime_util.h" |
8 #include "net/base/platform_mime_util.h" | 8 #include "net/base/platform_mime_util.h" |
9 | 9 |
10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 const char* extensions; // comma separated list | 59 const char* extensions; // comma separated list |
60 }; | 60 }; |
61 | 61 |
62 static const MimeInfo primary_mappings[] = { | 62 static const MimeInfo primary_mappings[] = { |
63 { "text/html", "html,htm" }, | 63 { "text/html", "html,htm" }, |
64 { "text/css", "css" }, | 64 { "text/css", "css" }, |
65 { "text/xml", "xml" }, | 65 { "text/xml", "xml" }, |
66 { "image/gif", "gif" }, | 66 { "image/gif", "gif" }, |
67 { "image/jpeg", "jpeg,jpg" }, | 67 { "image/jpeg", "jpeg,jpg" }, |
68 { "image/png", "png" }, | 68 { "image/png", "png" }, |
| 69 { "video/mp4", "mp4,m4v" }, |
| 70 { "audio/x-m4a", "m4a" }, |
| 71 { "audio/mp3", "mp3" }, |
| 72 { "video/ogg", "ogv,ogm" }, |
| 73 { "audio/ogg", "ogg,oga" }, |
69 { "application/xhtml+xml", "xhtml,xht" } | 74 { "application/xhtml+xml", "xhtml,xht" } |
70 }; | 75 }; |
71 | 76 |
72 static const MimeInfo secondary_mappings[] = { | 77 static const MimeInfo secondary_mappings[] = { |
73 { "application/octet-stream", "exe,com,bin" }, | 78 { "application/octet-stream", "exe,com,bin" }, |
74 { "application/gzip", "gz" }, | 79 { "application/gzip", "gz" }, |
75 { "application/pdf", "pdf" }, | 80 { "application/pdf", "pdf" }, |
76 { "application/postscript", "ps,eps,ai" }, | 81 { "application/postscript", "ps,eps,ai" }, |
77 { "application/x-javascript", "js" }, | 82 { "application/x-javascript", "js" }, |
78 { "image/bmp", "bmp" }, | 83 { "image/bmp", "bmp" }, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 "image/jpeg", | 166 "image/jpeg", |
162 "image/pjpeg", | 167 "image/pjpeg", |
163 "image/jpg", | 168 "image/jpg", |
164 "image/png", | 169 "image/png", |
165 "image/gif", | 170 "image/gif", |
166 "image/bmp", | 171 "image/bmp", |
167 "image/x-icon", // ico | 172 "image/x-icon", // ico |
168 "image/x-xbitmap" // xbm | 173 "image/x-xbitmap" // xbm |
169 }; | 174 }; |
170 | 175 |
171 // TODO(hclam): Integrate this list with |secondary_mappings| above. | 176 // A list of media types: http://en.wikipedia.org/wiki/Internet_media_type |
| 177 // A comprehensive mime type list: http://plugindoc.mozdev.org/winmime.php |
| 178 |
172 static const char* const supported_media_types[] = { | 179 static const char* const supported_media_types[] = { |
173 // Ogg. | 180 // Ogg. |
| 181 "video/ogg", |
174 "audio/ogg", | 182 "audio/ogg", |
175 "video/ogg", | |
176 | 183 |
177 // MPEG-4. | 184 // MPEG-4. |
178 "application/mp4", | 185 "video/mp4", |
| 186 "video/x-m4v", |
179 "audio/mp4", | 187 "audio/mp4", |
180 "audio/x-m4a", | 188 "audio/x-m4a", |
181 "video/mp4", | |
182 "video/x-m4v", | |
183 | 189 |
184 // MP3. | 190 // MP3. |
185 // TODO(hclam): may add "audio/mpeg" and "audio/x-mp3". | |
186 "audio/mp3", | 191 "audio/mp3", |
187 | 192 "audio/x-mp3", |
188 // AAC. | |
189 "audio/aac", | |
190 "audio/x-aac" | |
191 | |
192 // Generic MPEG mime-types. | |
193 "audio/mpeg", | |
194 "video/mpeg" | |
195 }; | 193 }; |
196 | 194 |
197 // Note: does not include javascript types list (see supported_javascript_types) | 195 // Note: does not include javascript types list (see supported_javascript_types) |
198 static const char* const supported_non_image_types[] = { | 196 static const char* const supported_non_image_types[] = { |
199 "text/html", | 197 "text/html", |
200 "text/xml", | 198 "text/xml", |
201 "text/xsl", | 199 "text/xsl", |
202 "text/plain", | 200 "text/plain", |
203 // Many users complained about css files served for | 201 // Many users complained about css files served for |
204 // download instead of displaying in the browser: | 202 // download instead of displaying in the browser: |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 bool IsSupportedMimeType(const std::string& mime_type) { | 377 bool IsSupportedMimeType(const std::string& mime_type) { |
380 return GetMimeUtil()->IsSupportedMimeType(mime_type); | 378 return GetMimeUtil()->IsSupportedMimeType(mime_type); |
381 } | 379 } |
382 | 380 |
383 bool MatchesMimeType(const std::string &mime_type_pattern, | 381 bool MatchesMimeType(const std::string &mime_type_pattern, |
384 const std::string &mime_type) { | 382 const std::string &mime_type) { |
385 return GetMimeUtil()->MatchesMimeType(mime_type_pattern, mime_type); | 383 return GetMimeUtil()->MatchesMimeType(mime_type_pattern, mime_type); |
386 } | 384 } |
387 | 385 |
388 } // namespace net | 386 } // namespace net |
OLD | NEW |