Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: net/base/mime_util.cc

Issue 7064044: Enabling MHTML. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « build/features_override.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 { "image/tiff", "tiff,tif" }, 110 { "image/tiff", "tiff,tif" },
111 { "image/x-xbitmap", "xbm" }, 111 { "image/x-xbitmap", "xbm" },
112 { "image/svg+xml", "svg,svgz" }, 112 { "image/svg+xml", "svg,svgz" },
113 { "message/rfc822", "eml" }, 113 { "message/rfc822", "eml" },
114 { "text/plain", "txt,text" }, 114 { "text/plain", "txt,text" },
115 { "text/html", "shtml,ehtml" }, 115 { "text/html", "shtml,ehtml" },
116 { "application/rss+xml", "rss" }, 116 { "application/rss+xml", "rss" },
117 { "application/rdf+xml", "rdf" }, 117 { "application/rdf+xml", "rdf" },
118 { "text/xml", "xsl,xbl" }, 118 { "text/xml", "xsl,xbl" },
119 { "application/vnd.mozilla.xul+xml", "xul" }, 119 { "application/vnd.mozilla.xul+xml", "xul" },
120 { "application/x-shockwave-flash", "swf,swl" } 120 { "application/x-shockwave-flash", "swf,swl" },
121 { "multipart/related", "mht,mhtml" }
121 }; 122 };
122 123
123 static const char* FindMimeType(const MimeInfo* mappings, 124 static const char* FindMimeType(const MimeInfo* mappings,
124 size_t mappings_len, 125 size_t mappings_len,
125 const char* ext) { 126 const char* ext) {
126 size_t ext_len = strlen(ext); 127 size_t ext_len = strlen(ext);
127 128
128 for (size_t i = 0; i < mappings_len; ++i) { 129 for (size_t i = 0; i < mappings_len; ++i) {
129 const char* extensions = mappings[i].extensions; 130 const char* extensions = mappings[i].extensions;
130 for (;;) { 131 for (;;) {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 "text/css", 260 "text/css",
260 "text/vnd.chromium.ftp-dir", 261 "text/vnd.chromium.ftp-dir",
261 "text/", 262 "text/",
262 "image/svg+xml", // SVG is text-based XML, even though it has an image/ type 263 "image/svg+xml", // SVG is text-based XML, even though it has an image/ type
263 "application/xml", 264 "application/xml",
264 "application/xhtml+xml", 265 "application/xhtml+xml",
265 "application/rss+xml", 266 "application/rss+xml",
266 "application/atom+xml", 267 "application/atom+xml",
267 "application/json", 268 "application/json",
268 "application/x-x509-user-cert", 269 "application/x-x509-user-cert",
270 "multipart/related", // For MHTML support.
269 "multipart/x-mixed-replace" 271 "multipart/x-mixed-replace"
270 // Note: ADDING a new type here will probably render it AS HTML. This can 272 // Note: ADDING a new type here will probably render it AS HTML. This can
271 // result in cross site scripting. 273 // result in cross site scripting.
272 }; 274 };
273 COMPILE_ASSERT(arraysize(supported_non_image_types) == 16, 275 COMPILE_ASSERT(arraysize(supported_non_image_types) == 17,
274 supported_non_images_types_must_equal_16); 276 supported_non_images_types_must_equal_17);
wtc 2011/05/25 00:31:49 This COMPILE_ASSERT probably should be removed. A
275 277
276 // Mozilla 1.8 and WinIE 7 both accept text/javascript and text/ecmascript. 278 // Mozilla 1.8 and WinIE 7 both accept text/javascript and text/ecmascript.
277 // Mozilla 1.8 accepts application/javascript, application/ecmascript, and 279 // Mozilla 1.8 accepts application/javascript, application/ecmascript, and
278 // application/x-javascript, but WinIE 7 doesn't. 280 // application/x-javascript, but WinIE 7 doesn't.
279 // WinIE 7 accepts text/javascript1.1 - text/javascript1.3, text/jscript, and 281 // WinIE 7 accepts text/javascript1.1 - text/javascript1.3, text/jscript, and
280 // text/livescript, but Mozilla 1.8 doesn't. 282 // text/livescript, but Mozilla 1.8 doesn't.
281 // Mozilla 1.8 allows leading and trailing whitespace, but WinIE 7 doesn't. 283 // Mozilla 1.8 allows leading and trailing whitespace, but WinIE 7 doesn't.
282 // Mozilla 1.8 and WinIE 7 both accept the empty string, but neither accept a 284 // Mozilla 1.8 and WinIE 7 both accept the empty string, but neither accept a
283 // whitespace-only string. 285 // whitespace-only string.
284 // We want to accept all the values that either of these browsers accept, but 286 // We want to accept all the values that either of these browsers accept, but
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 709
708 GetExtensionsFromHardCodedMappings(secondary_mappings, 710 GetExtensionsFromHardCodedMappings(secondary_mappings,
709 arraysize(secondary_mappings), 711 arraysize(secondary_mappings),
710 mime_type, 712 mime_type,
711 &unique_extensions); 713 &unique_extensions);
712 714
713 HashSetToVector(&unique_extensions, extensions); 715 HashSetToVector(&unique_extensions, extensions);
714 } 716 }
715 717
716 } // namespace net 718 } // namespace net
OLDNEW
« no previous file with comments | « build/features_override.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698