| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 const char* extensions; // comma separated list | 62 const char* extensions; // comma separated list |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 static const MimeInfo primary_mappings[] = { | 65 static const MimeInfo primary_mappings[] = { |
| 66 { "text/html", "html,htm" }, | 66 { "text/html", "html,htm" }, |
| 67 { "text/css", "css" }, | 67 { "text/css", "css" }, |
| 68 { "text/xml", "xml" }, | 68 { "text/xml", "xml" }, |
| 69 { "image/gif", "gif" }, | 69 { "image/gif", "gif" }, |
| 70 { "image/jpeg", "jpeg,jpg" }, | 70 { "image/jpeg", "jpeg,jpg" }, |
| 71 { "image/png", "png" }, | 71 { "image/png", "png" }, |
| 72 #if defined(GOOGLE_CHROME_BUILD) | |
| 73 { "video/mp4", "mp4,m4v" }, | 72 { "video/mp4", "mp4,m4v" }, |
| 74 { "audio/x-m4a", "m4a" }, | 73 { "audio/x-m4a", "m4a" }, |
| 75 { "audio/mp3", "mp3" }, | 74 { "audio/mp3", "mp3" }, |
| 76 #endif | |
| 77 { "video/ogg", "ogv,ogm" }, | 75 { "video/ogg", "ogv,ogm" }, |
| 78 { "audio/ogg", "ogg,oga" }, | 76 { "audio/ogg", "ogg,oga" }, |
| 79 { "application/xhtml+xml", "xhtml,xht" } | 77 { "application/xhtml+xml", "xhtml,xht" } |
| 80 }; | 78 }; |
| 81 | 79 |
| 82 static const MimeInfo secondary_mappings[] = { | 80 static const MimeInfo secondary_mappings[] = { |
| 83 { "application/octet-stream", "exe,com,bin" }, | 81 { "application/octet-stream", "exe,com,bin" }, |
| 84 { "application/gzip", "gz" }, | 82 { "application/gzip", "gz" }, |
| 85 { "application/pdf", "pdf" }, | 83 { "application/pdf", "pdf" }, |
| 86 { "application/postscript", "ps,eps,ai" }, | 84 { "application/postscript", "ps,eps,ai" }, |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 "image/jpg", | 171 "image/jpg", |
| 174 "image/png", | 172 "image/png", |
| 175 "image/gif", | 173 "image/gif", |
| 176 "image/bmp", | 174 "image/bmp", |
| 177 "image/x-icon", // ico | 175 "image/x-icon", // ico |
| 178 "image/x-xbitmap" // xbm | 176 "image/x-xbitmap" // xbm |
| 179 }; | 177 }; |
| 180 | 178 |
| 181 // A list of media types: http://en.wikipedia.org/wiki/Internet_media_type | 179 // A list of media types: http://en.wikipedia.org/wiki/Internet_media_type |
| 182 // A comprehensive mime type list: http://plugindoc.mozdev.org/winmime.php | 180 // A comprehensive mime type list: http://plugindoc.mozdev.org/winmime.php |
| 183 | |
| 184 static const char* const supported_media_types[] = { | 181 static const char* const supported_media_types[] = { |
| 185 // Ogg. | 182 // Ogg. |
| 186 "video/ogg", | 183 "video/ogg", |
| 187 "audio/ogg", | 184 "audio/ogg", |
| 188 | 185 |
| 189 // TODO(fbarchard): Remove these for Chromium when layout tests dont use mp4 | 186 #if defined(GOOGLE_CHROME_BUILD) |
| 190 // MPEG-4. | 187 // MPEG-4. |
| 191 "video/mp4", | 188 "video/mp4", |
| 192 "video/x-m4v", | 189 "video/x-m4v", |
| 193 "audio/mp4", | 190 "audio/mp4", |
| 194 "audio/x-m4a", | 191 "audio/x-m4a", |
| 195 | 192 |
| 196 // MP3. | 193 // MP3. |
| 197 "audio/mp3", | 194 "audio/mp3", |
| 198 "audio/x-mp3", | 195 "audio/x-mp3", |
| 199 | 196 #endif |
| 200 // Generic MPEG mime-types. | |
| 201 // TODO(fbarchard): Remove these when layout tests stop using mpg. | |
| 202 "audio/mpeg", | |
| 203 "video/mpeg" | |
| 204 }; | 197 }; |
| 205 | 198 |
| 206 // Note: does not include javascript types list (see supported_javascript_types) | 199 // Note: does not include javascript types list (see supported_javascript_types) |
| 207 static const char* const supported_non_image_types[] = { | 200 static const char* const supported_non_image_types[] = { |
| 208 "text/html", | 201 "text/html", |
| 209 "text/xml", | 202 "text/xml", |
| 210 "text/xsl", | 203 "text/xsl", |
| 211 "text/plain", | 204 "text/plain", |
| 212 // Many users complained about css files served for | 205 // Many users complained about css files served for |
| 213 // download instead of displaying in the browser: | 206 // download instead of displaying in the browser: |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 const std::string &mime_type) { | 402 const std::string &mime_type) { |
| 410 return GetMimeUtil()->MatchesMimeType(mime_type_pattern, mime_type); | 403 return GetMimeUtil()->MatchesMimeType(mime_type_pattern, mime_type); |
| 411 } | 404 } |
| 412 | 405 |
| 413 void ParseCodecString(const std::string& codecs, | 406 void ParseCodecString(const std::string& codecs, |
| 414 std::vector<std::string>* codecs_out) { | 407 std::vector<std::string>* codecs_out) { |
| 415 GetMimeUtil()->ParseCodecString(codecs, codecs_out); | 408 GetMimeUtil()->ParseCodecString(codecs, codecs_out); |
| 416 } | 409 } |
| 417 | 410 |
| 418 } // namespace net | 411 } // namespace net |
| OLD | NEW |