Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 { "image/png", "png" }, | 88 { "image/png", "png" }, |
| 89 { "video/mp4", "mp4,m4v" }, | 89 { "video/mp4", "mp4,m4v" }, |
| 90 { "audio/x-m4a", "m4a" }, | 90 { "audio/x-m4a", "m4a" }, |
| 91 { "audio/mp3", "mp3" }, | 91 { "audio/mp3", "mp3" }, |
| 92 { "video/ogg", "ogv,ogm" }, | 92 { "video/ogg", "ogv,ogm" }, |
| 93 { "audio/ogg", "ogg,oga" }, | 93 { "audio/ogg", "ogg,oga" }, |
| 94 { "video/webm", "webm" }, | 94 { "video/webm", "webm" }, |
| 95 { "audio/webm", "webm" }, | 95 { "audio/webm", "webm" }, |
| 96 { "audio/wav", "wav" }, | 96 { "audio/wav", "wav" }, |
| 97 { "application/xhtml+xml", "xhtml,xht" }, | 97 { "application/xhtml+xml", "xhtml,xht" }, |
| 98 { "application/x-chrome-extension", "crx" } | 98 { "application/x-chrome-extension", "crx" }, |
| 99 { "multipart/related", "mht,mhtml" } | |
|
wtc
2011/05/27 17:21:12
Nit: it seems better to list mhtml before mht.
See
| |
| 99 }; | 100 }; |
| 100 | 101 |
| 101 static const MimeInfo secondary_mappings[] = { | 102 static const MimeInfo secondary_mappings[] = { |
| 102 { "application/octet-stream", "exe,com,bin" }, | 103 { "application/octet-stream", "exe,com,bin" }, |
| 103 { "application/gzip", "gz" }, | 104 { "application/gzip", "gz" }, |
| 104 { "application/pdf", "pdf" }, | 105 { "application/pdf", "pdf" }, |
| 105 { "application/postscript", "ps,eps,ai" }, | 106 { "application/postscript", "ps,eps,ai" }, |
| 106 { "application/x-javascript", "js" }, | 107 { "application/x-javascript", "js" }, |
| 107 { "image/bmp", "bmp" }, | 108 { "image/bmp", "bmp" }, |
| 108 { "image/x-icon", "ico" }, | 109 { "image/x-icon", "ico" }, |
| 109 { "image/jpeg", "jfif,pjpeg,pjp" }, | 110 { "image/jpeg", "jfif,pjpeg,pjp" }, |
| 110 { "image/tiff", "tiff,tif" }, | 111 { "image/tiff", "tiff,tif" }, |
| 111 { "image/x-xbitmap", "xbm" }, | 112 { "image/x-xbitmap", "xbm" }, |
| 112 { "image/svg+xml", "svg,svgz" }, | 113 { "image/svg+xml", "svg,svgz" }, |
| 113 { "message/rfc822", "eml" }, | 114 { "message/rfc822", "eml" }, |
| 114 { "text/plain", "txt,text" }, | 115 { "text/plain", "txt,text" }, |
| 115 { "text/html", "shtml,ehtml" }, | 116 { "text/html", "shtml,ehtml" }, |
| 116 { "application/rss+xml", "rss" }, | 117 { "application/rss+xml", "rss" }, |
| 117 { "application/rdf+xml", "rdf" }, | 118 { "application/rdf+xml", "rdf" }, |
| 118 { "text/xml", "xsl,xbl" }, | 119 { "text/xml", "xsl,xbl" }, |
| 119 { "application/vnd.mozilla.xul+xml", "xul" }, | 120 { "application/vnd.mozilla.xul+xml", "xul" }, |
| 120 { "application/x-shockwave-flash", "swf,swl" }, | 121 { "application/x-shockwave-flash", "swf,swl" } |
| 121 { "multipart/related", "mht,mhtml" } | |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 static const char* FindMimeType(const MimeInfo* mappings, | 124 static const char* FindMimeType(const MimeInfo* mappings, |
| 125 size_t mappings_len, | 125 size_t mappings_len, |
| 126 const char* ext) { | 126 const char* ext) { |
| 127 size_t ext_len = strlen(ext); | 127 size_t ext_len = strlen(ext); |
| 128 | 128 |
| 129 for (size_t i = 0; i < mappings_len; ++i) { | 129 for (size_t i = 0; i < mappings_len; ++i) { |
| 130 const char* extensions = mappings[i].extensions; | 130 const char* extensions = mappings[i].extensions; |
| 131 for (;;) { | 131 for (;;) { |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 707 | 707 |
| 708 GetExtensionsFromHardCodedMappings(secondary_mappings, | 708 GetExtensionsFromHardCodedMappings(secondary_mappings, |
| 709 arraysize(secondary_mappings), | 709 arraysize(secondary_mappings), |
| 710 mime_type, | 710 mime_type, |
| 711 &unique_extensions); | 711 &unique_extensions); |
| 712 | 712 |
| 713 HashSetToVector(&unique_extensions, extensions); | 713 HashSetToVector(&unique_extensions, extensions); |
| 714 } | 714 } |
| 715 | 715 |
| 716 } // namespace net | 716 } // namespace net |
| OLD | NEW |