Index: net/base/mime_util.cc |
diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc |
index fdb16fd8f7ef0b0f22b2d2e232198587ce19344d..3ac7353aba0c28ad4344372e1dfede9b241d656a 100644 |
--- a/net/base/mime_util.cc |
+++ b/net/base/mime_util.cc |
@@ -31,15 +31,15 @@ struct MediaType { |
}; |
static const MediaType kIanaMediaTypes[] = { |
- { "application", "application/" }, |
- { "audio", "audio/" }, |
- { "example", "example/" }, |
- { "image", "image/" }, |
- { "message", "message/" }, |
- { "model", "model/" }, |
- { "multipart", "multipart/" }, |
- { "text", "text/" }, |
- { "video", "video/" }, |
+ {"application", "application/"}, |
+ {"audio", "audio/"}, |
+ {"example", "example/"}, |
+ {"image", "image/"}, |
+ {"message", "message/"}, |
+ {"model", "model/"}, |
+ {"multipart", "multipart/"}, |
+ {"text", "text/"}, |
+ {"video", "video/"}, |
}; |
} // namespace |
@@ -66,8 +66,8 @@ class MimeUtil : public PlatformMimeUtil { |
bool IsSupportedMimeType(const std::string& mime_type) const; |
- bool MatchesMimeType(const std::string &mime_type_pattern, |
- const std::string &mime_type) const; |
+ bool MatchesMimeType(const std::string& mime_type_pattern, |
+ const std::string& mime_type) const; |
bool IsMimeType(const std::string& type_string) const; |
@@ -124,51 +124,49 @@ struct MimeInfo { |
}; |
static const MimeInfo primary_mappings[] = { |
- { "text/html", "html,htm,shtml,shtm" }, |
- { "text/css", "css" }, |
- { "text/xml", "xml" }, |
- { "image/gif", "gif" }, |
- { "image/jpeg", "jpeg,jpg" }, |
- { "image/webp", "webp" }, |
- { "image/png", "png" }, |
- { "video/mp4", "mp4,m4v" }, |
- { "audio/x-m4a", "m4a" }, |
- { "audio/mp3", "mp3" }, |
- { "video/ogg", "ogv,ogm" }, |
- { "audio/ogg", "ogg,oga,opus" }, |
- { "video/webm", "webm" }, |
- { "audio/webm", "webm" }, |
- { "audio/wav", "wav" }, |
- { "application/xhtml+xml", "xhtml,xht,xhtm" }, |
- { "application/x-chrome-extension", "crx" }, |
- { "multipart/related", "mhtml,mht" } |
-}; |
+ {"text/html", "html,htm,shtml,shtm"}, |
+ {"text/css", "css"}, |
+ {"text/xml", "xml"}, |
+ {"image/gif", "gif"}, |
+ {"image/jpeg", "jpeg,jpg"}, |
+ {"image/webp", "webp"}, |
+ {"image/png", "png"}, |
+ {"video/mp4", "mp4,m4v"}, |
+ {"audio/x-m4a", "m4a"}, |
+ {"audio/mp3", "mp3"}, |
+ {"video/ogg", "ogv,ogm"}, |
+ {"audio/ogg", "ogg,oga,opus"}, |
+ {"video/webm", "webm"}, |
+ {"audio/webm", "webm"}, |
+ {"audio/wav", "wav"}, |
+ {"application/xhtml+xml", "xhtml,xht,xhtm"}, |
+ {"application/x-chrome-extension", "crx"}, |
+ {"multipart/related", "mhtml,mht"}}; |
static const MimeInfo secondary_mappings[] = { |
- { "application/octet-stream", "exe,com,bin" }, |
- { "application/gzip", "gz" }, |
- { "application/pdf", "pdf" }, |
- { "application/postscript", "ps,eps,ai" }, |
- { "application/javascript", "js" }, |
- { "application/font-woff", "woff" }, |
- { "image/bmp", "bmp" }, |
- { "image/x-icon", "ico" }, |
- { "image/vnd.microsoft.icon", "ico" }, |
- { "image/jpeg", "jfif,pjpeg,pjp" }, |
- { "image/tiff", "tiff,tif" }, |
- { "image/x-xbitmap", "xbm" }, |
- { "image/svg+xml", "svg,svgz" }, |
- { "message/rfc822", "eml" }, |
- { "text/plain", "txt,text" }, |
- { "text/html", "ehtml" }, |
- { "application/rss+xml", "rss" }, |
- { "application/rdf+xml", "rdf" }, |
- { "text/xml", "xsl,xbl,xslt" }, |
- { "application/vnd.mozilla.xul+xml", "xul" }, |
- { "application/x-shockwave-flash", "swf,swl" }, |
- { "application/pkcs7-mime", "p7m,p7c,p7z" }, |
- { "application/pkcs7-signature", "p7s" } |
-}; |
+ {"application/octet-stream", "exe,com,bin"}, |
+ {"application/gzip", "gz"}, |
+ {"application/pdf", "pdf"}, |
+ {"application/postscript", "ps,eps,ai"}, |
+ {"application/javascript", "js"}, |
+ {"application/font-woff", "woff"}, |
+ {"image/bmp", "bmp"}, |
+ {"image/x-icon", "ico"}, |
+ {"image/vnd.microsoft.icon", "ico"}, |
+ {"image/jpeg", "jfif,pjpeg,pjp"}, |
+ {"image/tiff", "tiff,tif"}, |
+ {"image/x-xbitmap", "xbm"}, |
+ {"image/svg+xml", "svg,svgz"}, |
+ {"message/rfc822", "eml"}, |
+ {"text/plain", "txt,text"}, |
+ {"text/html", "ehtml"}, |
+ {"application/rss+xml", "rss"}, |
+ {"application/rdf+xml", "rdf"}, |
+ {"text/xml", "xsl,xbl,xslt"}, |
+ {"application/vnd.mozilla.xul+xml", "xul"}, |
+ {"application/x-shockwave-flash", "swf,swl"}, |
+ {"application/pkcs7-mime", "p7m,p7c,p7z"}, |
+ {"application/pkcs7-signature", "p7s"}}; |
static const char* FindMimeType(const MimeInfo* mappings, |
size_t mappings_len, |
@@ -227,9 +225,8 @@ bool MimeUtil::GetMimeTypeFromExtensionHelper( |
base::FilePath path_ext(ext); |
const string ext_narrow_str = path_ext.AsUTF8Unsafe(); |
- const char* mime_type = FindMimeType(primary_mappings, |
- arraysize(primary_mappings), |
- ext_narrow_str.c_str()); |
+ const char* mime_type = FindMimeType( |
+ primary_mappings, arraysize(primary_mappings), ext_narrow_str.c_str()); |
if (mime_type) { |
*result = mime_type; |
return true; |
@@ -238,7 +235,8 @@ bool MimeUtil::GetMimeTypeFromExtensionHelper( |
if (include_platform_types && GetPlatformMimeTypeFromExtension(ext, result)) |
return true; |
- mime_type = FindMimeType(secondary_mappings, arraysize(secondary_mappings), |
+ mime_type = FindMimeType(secondary_mappings, |
+ arraysize(secondary_mappings), |
ext_narrow_str.c_str()); |
if (mime_type) { |
*result = mime_type; |
@@ -251,56 +249,42 @@ bool MimeUtil::GetMimeTypeFromExtensionHelper( |
// From WebKit's WebCore/platform/MIMETypeRegistry.cpp: |
static const char* const supported_image_types[] = { |
- "image/jpeg", |
- "image/pjpeg", |
- "image/jpg", |
- "image/webp", |
- "image/png", |
- "image/gif", |
- "image/bmp", |
- "image/vnd.microsoft.icon", // ico |
- "image/x-icon", // ico |
- "image/x-xbitmap" // xbm |
+ "image/jpeg", "image/pjpeg", "image/jpg", "image/webp", |
+ "image/png", "image/gif", "image/bmp", |
mmenke
2014/10/10 18:12:39
This is kinda weird.
|
+ "image/vnd.microsoft.icon", // ico |
+ "image/x-icon", // ico |
+ "image/x-xbitmap" // xbm |
}; |
// A list of media types: http://en.wikipedia.org/wiki/Internet_media_type |
// A comprehensive mime type list: http://plugindoc.mozdev.org/winmime.php |
// This set of codecs is supported by all variations of Chromium. |
static const char* const common_media_types[] = { |
- // Ogg. |
- "audio/ogg", |
- "application/ogg", |
+ // Ogg. |
+ "audio/ogg", "application/ogg", |
#if !defined(OS_ANDROID) // Android doesn't support Ogg Theora. |
- "video/ogg", |
+ "video/ogg", |
#endif |
- // WebM. |
- "video/webm", |
- "audio/webm", |
+ // WebM. |
+ "video/webm", "audio/webm", |
- // Wav. |
- "audio/wav", |
- "audio/x-wav", |
+ // Wav. |
+ "audio/wav", "audio/x-wav", |
#if defined(OS_ANDROID) |
- // HLS. Supported by Android ICS and above. |
- "application/vnd.apple.mpegurl", |
- "application/x-mpegurl", |
+ // HLS. Supported by Android ICS and above. |
+ "application/vnd.apple.mpegurl", "application/x-mpegurl", |
#endif |
}; |
// List of proprietary types only supported by Google Chrome. |
static const char* const proprietary_media_types[] = { |
- // MPEG-4. |
- "video/mp4", |
- "video/x-m4v", |
- "audio/mp4", |
- "audio/x-m4a", |
- |
- // MP3. |
- "audio/mp3", |
- "audio/x-mp3", |
- "audio/mpeg", |
+ // MPEG-4. |
+ "video/mp4", "video/x-m4v", "audio/mp4", "audio/x-m4a", |
+ |
+ // MP3. |
+ "audio/mp3", "audio/x-mp3", "audio/mpeg", |
}; |
// List of supported codecs when passed in with <source type="...">. |
@@ -313,37 +297,28 @@ static const char* const proprietary_media_types[] = { |
// http://tools.ietf.org/html/rfc2361 |
static const char* const common_media_codecs[] = { |
#if !defined(OS_ANDROID) // Android doesn't support Ogg Theora. |
- "theora", |
+ "theora", |
#endif |
- "opus", |
- "vorbis", |
- "vp8", |
- "vp9", |
- "1" // WAVE_FORMAT_PCM. |
+ "opus", "vorbis", "vp8", "vp9", |
+ "1" // WAVE_FORMAT_PCM. |
}; |
// List of proprietary codecs only supported by Google Chrome. |
-static const char* const proprietary_media_codecs[] = { |
- "avc1", |
- "avc3", |
- "mp4a" |
-}; |
+static const char* const proprietary_media_codecs[] = {"avc1", "avc3", "mp4a"}; |
// Note: |
// - does not include javascript types list (see supported_javascript_types) |
// - does not include types starting with "text/" (see |
// IsSupportedNonImageMimeType()) |
static const char* const supported_non_image_types[] = { |
- "image/svg+xml", // SVG is text-based XML, even though it has an image/ type |
- "application/xml", |
- "application/atom+xml", |
- "application/rss+xml", |
- "application/xhtml+xml", |
- "application/json", |
- "multipart/related", // For MHTML support. |
- "multipart/x-mixed-replace" |
- // Note: ADDING a new type here will probably render it AS HTML. This can |
- // result in cross site scripting. |
+ "image/svg+xml", // SVG is text-based XML, even though it has an image/ |
+ // type |
+ "application/xml", "application/atom+xml", "application/rss+xml", |
+ "application/xhtml+xml", "application/json", |
+ "multipart/related", // For MHTML support. |
+ "multipart/x-mixed-replace" |
+ // Note: ADDING a new type here will probably render it AS HTML. This can |
+ // result in cross site scripting. |
}; |
// Dictionary of cryptographic file mime types. |
@@ -353,11 +328,10 @@ struct CertificateMimeTypeInfo { |
}; |
static const CertificateMimeTypeInfo supported_certificate_types[] = { |
- { "application/x-x509-user-cert", |
- CERTIFICATE_MIME_TYPE_X509_USER_CERT }, |
+ {"application/x-x509-user-cert", CERTIFICATE_MIME_TYPE_X509_USER_CERT}, |
#if defined(OS_ANDROID) |
- { "application/x-x509-ca-cert", CERTIFICATE_MIME_TYPE_X509_CA_CERT }, |
- { "application/x-pkcs12", CERTIFICATE_MIME_TYPE_PKCS12_ARCHIVE }, |
+ {"application/x-x509-ca-cert", CERTIFICATE_MIME_TYPE_X509_CA_CERT}, |
+ {"application/x-pkcs12", CERTIFICATE_MIME_TYPE_PKCS12_ARCHIVE}, |
#endif |
}; |
@@ -365,25 +339,17 @@ static const CertificateMimeTypeInfo supported_certificate_types[] = { |
// while they are technically text, it's very unlikely that a user expects to |
// see them rendered in text form. |
static const char* const unsupported_text_types[] = { |
- "text/calendar", |
- "text/x-calendar", |
- "text/x-vcalendar", |
- "text/vcalendar", |
- "text/vcard", |
- "text/x-vcard", |
- "text/directory", |
- "text/ldif", |
- "text/qif", |
- "text/x-qif", |
- "text/x-csv", |
- "text/x-vcf", |
- "text/rtf", |
- "text/comma-separated-values", |
- "text/csv", |
- "text/tab-separated-values", |
- "text/tsv", |
- "text/ofx", // http://crbug.com/162238 |
- "text/vnd.sun.j2me.app-descriptor" // http://crbug.com/176450 |
+ "text/calendar", "text/x-calendar", |
+ "text/x-vcalendar", "text/vcalendar", |
+ "text/vcard", "text/x-vcard", |
+ "text/directory", "text/ldif", |
+ "text/qif", "text/x-qif", |
+ "text/x-csv", "text/x-vcf", |
+ "text/rtf", "text/comma-separated-values", |
+ "text/csv", "text/tab-separated-values", |
+ "text/tsv", |
+ "text/ofx", // http://crbug.com/162238 |
+ "text/vnd.sun.j2me.app-descriptor" // http://crbug.com/176450 |
}; |
// Mozilla 1.8 and WinIE 7 both accept text/javascript and text/ecmascript. |
@@ -397,17 +363,11 @@ static const char* const unsupported_text_types[] = { |
// We want to accept all the values that either of these browsers accept, but |
// not other values. |
static const char* const supported_javascript_types[] = { |
- "text/javascript", |
- "text/ecmascript", |
- "application/javascript", |
- "application/ecmascript", |
- "application/x-javascript", |
- "text/javascript1.1", |
- "text/javascript1.2", |
- "text/javascript1.3", |
- "text/jscript", |
- "text/livescript" |
-}; |
+ "text/javascript", "text/ecmascript", |
+ "application/javascript", "application/ecmascript", |
+ "application/x-javascript", "text/javascript1.1", |
+ "text/javascript1.2", "text/javascript1.3", |
+ "text/jscript", "text/livescript"}; |
#if defined(OS_ANDROID) |
static bool IsCodecSupportedOnAndroid(const std::string& codec) { |
@@ -432,17 +392,16 @@ struct MediaFormatStrict { |
}; |
static const MediaFormatStrict format_codec_mappings[] = { |
- { "video/webm", "opus,vorbis,vp8,vp8.0,vp9,vp9.0" }, |
- { "audio/webm", "opus,vorbis" }, |
- { "audio/wav", "1" }, |
- { "audio/x-wav", "1" }, |
- { "video/ogg", "opus,theora,vorbis" }, |
- { "audio/ogg", "opus,vorbis" }, |
- { "application/ogg", "opus,theora,vorbis" }, |
- { "audio/mpeg", "" }, |
- { "audio/mp3", "" }, |
- { "audio/x-mp3", "" } |
-}; |
+ {"video/webm", "opus,vorbis,vp8,vp8.0,vp9,vp9.0"}, |
+ {"audio/webm", "opus,vorbis"}, |
+ {"audio/wav", "1"}, |
+ {"audio/x-wav", "1"}, |
+ {"video/ogg", "opus,theora,vorbis"}, |
+ {"audio/ogg", "opus,vorbis"}, |
+ {"application/ogg", "opus,theora,vorbis"}, |
+ {"audio/mpeg", ""}, |
+ {"audio/mp3", ""}, |
+ {"audio/x-mp3", ""}}; |
MimeUtil::MimeUtil() { |
InitializeMimeTypeMaps(); |
@@ -507,9 +466,8 @@ void MimeUtil::InitializeMimeTypeMaps() { |
// Initialize the strict supported media types. |
for (size_t i = 0; i < arraysize(format_codec_mappings); ++i) { |
std::vector<std::string> mime_type_codecs; |
- ParseCodecString(format_codec_mappings[i].codecs_list, |
- &mime_type_codecs, |
- false); |
+ ParseCodecString( |
+ format_codec_mappings[i].codecs_list, &mime_type_codecs, false); |
MimeMappings codecs; |
for (size_t j = 0; j < mime_type_codecs.size(); ++j) { |
@@ -533,10 +491,10 @@ bool MimeUtil::IsSupportedMediaMimeType(const std::string& mime_type) const { |
bool MimeUtil::IsSupportedNonImageMimeType(const std::string& mime_type) const { |
return non_image_map_.find(mime_type) != non_image_map_.end() || |
- (mime_type.compare(0, 5, "text/") == 0 && |
- !IsUnsupportedTextMimeType(mime_type)) || |
- (mime_type.compare(0, 12, "application/") == 0 && |
- MatchesMimeType("application/*+json", mime_type)); |
+ (mime_type.compare(0, 5, "text/") == 0 && |
+ !IsUnsupportedTextMimeType(mime_type)) || |
+ (mime_type.compare(0, 12, "application/") == 0 && |
+ MatchesMimeType("application/*+json", mime_type)); |
} |
bool MimeUtil::IsUnsupportedTextMimeType(const std::string& mime_type) const { |
@@ -567,18 +525,18 @@ bool MatchesMimeTypeParameters(const std::string& mime_type_pattern, |
return false; |
std::vector<std::string> pattern_parameters; |
- base::SplitString(mime_type_pattern.substr(semicolon + 1), |
- ';', &pattern_parameters); |
+ base::SplitString( |
+ mime_type_pattern.substr(semicolon + 1), ';', &pattern_parameters); |
std::vector<std::string> test_parameters; |
- base::SplitString(mime_type.substr(test_semicolon + 1), |
- ';', &test_parameters); |
+ base::SplitString( |
+ mime_type.substr(test_semicolon + 1), ';', &test_parameters); |
sort(pattern_parameters.begin(), pattern_parameters.end()); |
sort(test_parameters.begin(), test_parameters.end()); |
std::vector<std::string> difference = |
- base::STLSetDifference<std::vector<std::string> >(pattern_parameters, |
- test_parameters); |
+ base::STLSetDifference<std::vector<std::string> >(pattern_parameters, |
+ test_parameters); |
return difference.size() == 0; |
} |
return true; |
@@ -636,15 +594,8 @@ bool MimeUtil::MatchesMimeType(const std::string& mime_type_pattern, |
// See http://www.iana.org/assignments/media-types/index.html |
static const char* legal_top_level_types[] = { |
- "application/", |
- "audio/", |
- "example/", |
- "image/", |
- "message/", |
- "model/", |
- "multipart/", |
- "text/", |
- "video/", |
+ "application/", "audio/", "example/", "image/", "message/", |
+ "model/", "multipart/", "text/", "video/", |
}; |
bool MimeUtil::IsMimeType(const std::string& type_string) const { |
@@ -666,8 +617,8 @@ bool MimeUtil::IsMimeType(const std::string& type_string) const { |
// If there's a "/" separator character, and the token before it is |
// "x-" + (ascii characters), it is also a MIME type. |
size_t slash = type_string.find('/'); |
- if (slash < 3 || |
- slash == std::string::npos || slash == type_string.length() - 1) { |
+ if (slash < 3 || slash == std::string::npos || |
+ slash == type_string.length() - 1) { |
return false; |
} |
@@ -713,7 +664,7 @@ bool MimeUtil::IsSupportedStrictMediaMimeType( |
const std::vector<std::string>& codecs) const { |
StrictMappings::const_iterator it = strict_format_map_.find(mime_type); |
return (it != strict_format_map_.end()) && |
- AreSupportedCodecs(it->second, codecs); |
+ AreSupportedCodecs(it->second, codecs); |
} |
void MimeUtil::RemoveProprietaryMediaTypesAndCodecsForTests() { |
@@ -807,65 +758,29 @@ namespace { |
// From http://www.w3schools.com/media/media_mimeref.asp and |
// http://plugindoc.mozdev.org/winmime.php |
static const char* const kStandardImageTypes[] = { |
- "image/bmp", |
- "image/cis-cod", |
- "image/gif", |
- "image/ief", |
- "image/jpeg", |
- "image/webp", |
- "image/pict", |
- "image/pipeg", |
- "image/png", |
- "image/svg+xml", |
- "image/tiff", |
- "image/vnd.microsoft.icon", |
- "image/x-cmu-raster", |
- "image/x-cmx", |
- "image/x-icon", |
- "image/x-portable-anymap", |
- "image/x-portable-bitmap", |
- "image/x-portable-graymap", |
- "image/x-portable-pixmap", |
- "image/x-rgb", |
- "image/x-xbitmap", |
- "image/x-xpixmap", |
- "image/x-xwindowdump" |
-}; |
+ "image/bmp", "image/cis-cod", |
+ "image/gif", "image/ief", |
+ "image/jpeg", "image/webp", |
+ "image/pict", "image/pipeg", |
+ "image/png", "image/svg+xml", |
+ "image/tiff", "image/vnd.microsoft.icon", |
+ "image/x-cmu-raster", "image/x-cmx", |
+ "image/x-icon", "image/x-portable-anymap", |
+ "image/x-portable-bitmap", "image/x-portable-graymap", |
+ "image/x-portable-pixmap", "image/x-rgb", |
+ "image/x-xbitmap", "image/x-xpixmap", |
+ "image/x-xwindowdump"}; |
static const char* const kStandardAudioTypes[] = { |
- "audio/aac", |
- "audio/aiff", |
- "audio/amr", |
- "audio/basic", |
- "audio/midi", |
- "audio/mp3", |
- "audio/mp4", |
- "audio/mpeg", |
- "audio/mpeg3", |
- "audio/ogg", |
- "audio/vorbis", |
- "audio/wav", |
- "audio/webm", |
- "audio/x-m4a", |
- "audio/x-ms-wma", |
- "audio/vnd.rn-realaudio", |
- "audio/vnd.wave" |
-}; |
+ "audio/aac", "audio/aiff", "audio/amr", "audio/basic", |
+ "audio/midi", "audio/mp3", "audio/mp4", "audio/mpeg", |
+ "audio/mpeg3", "audio/ogg", "audio/vorbis", "audio/wav", |
+ "audio/webm", "audio/x-m4a", "audio/x-ms-wma", "audio/vnd.rn-realaudio", |
+ "audio/vnd.wave"}; |
static const char* const kStandardVideoTypes[] = { |
- "video/avi", |
- "video/divx", |
- "video/flc", |
- "video/mp4", |
- "video/mpeg", |
- "video/ogg", |
- "video/quicktime", |
- "video/sd-video", |
- "video/webm", |
- "video/x-dv", |
- "video/x-m4v", |
- "video/x-mpeg", |
- "video/x-ms-asf", |
- "video/x-ms-wmv" |
-}; |
+ "video/avi", "video/divx", "video/flc", "video/mp4", |
+ "video/mpeg", "video/ogg", "video/quicktime", "video/sd-video", |
+ "video/webm", "video/x-dv", "video/x-m4v", "video/x-mpeg", |
+ "video/x-ms-asf", "video/x-ms-wmv"}; |
struct StandardType { |
const char* leading_mime_type; |
@@ -873,11 +788,10 @@ struct StandardType { |
size_t standard_types_len; |
}; |
static const StandardType kStandardTypes[] = { |
- { "image/", kStandardImageTypes, arraysize(kStandardImageTypes) }, |
- { "audio/", kStandardAudioTypes, arraysize(kStandardAudioTypes) }, |
- { "video/", kStandardVideoTypes, arraysize(kStandardVideoTypes) }, |
- { NULL, NULL, 0 } |
-}; |
+ {"image/", kStandardImageTypes, arraysize(kStandardImageTypes)}, |
+ {"audio/", kStandardAudioTypes, arraysize(kStandardAudioTypes)}, |
+ {"video/", kStandardVideoTypes, arraysize(kStandardVideoTypes)}, |
+ {NULL, NULL, 0}}; |
void GetExtensionsFromHardCodedMappings( |
const MimeInfo* mappings, |
@@ -888,8 +802,8 @@ void GetExtensionsFromHardCodedMappings( |
for (size_t i = 0; i < mappings_len; ++i) { |
if (StartsWithASCII(mappings[i].mime_type, leading_mime_type, false)) { |
std::vector<string> this_extensions; |
- base::SplitStringUsingSubstr(mappings[i].extensions, ",", |
- &this_extensions); |
+ base::SplitStringUsingSubstr( |
+ mappings[i].extensions, ",", &this_extensions); |
for (size_t j = 0; j < this_extensions.size(); ++j) { |
#if defined(OS_WIN) |
base::FilePath::StringType extension( |
@@ -928,13 +842,14 @@ void GetExtensionsHelper( |
// Note that the elements in the source set will be appended to the target |
// vector. |
-template<class T> |
+template <class T> |
void HashSetToVector(base::hash_set<T>* source, std::vector<T>* target) { |
size_t old_target_size = target->size(); |
target->resize(old_target_size + source->size()); |
size_t i = 0; |
for (typename base::hash_set<T>::iterator iter = source->begin(); |
- iter != source->end(); ++iter, ++i) |
+ iter != source->end(); |
+ ++iter, ++i) |
(*target)[old_target_size + i] = *iter; |
} |
} |
@@ -1010,8 +925,7 @@ CertificateMimeType GetCertificateMimeTypeForMimeType( |
} |
bool IsSupportedCertificateMimeType(const std::string& mime_type) { |
- CertificateMimeType file_type = |
- GetCertificateMimeTypeForMimeType(mime_type); |
+ CertificateMimeType file_type = GetCertificateMimeTypeForMimeType(mime_type); |
return file_type != CERTIFICATE_MIME_TYPE_UNKNOWN; |
} |
@@ -1024,8 +938,8 @@ void AddMultipartValueForUpload(const std::string& value_name, |
// First line is the boundary. |
post_data->append("--" + mime_boundary + "\r\n"); |
// Next line is the Content-disposition. |
- post_data->append("Content-Disposition: form-data; name=\"" + |
- value_name + "\"\r\n"); |
+ post_data->append("Content-Disposition: form-data; name=\"" + value_name + |
+ "\"\r\n"); |
if (!content_type.empty()) { |
// If Content-type is specified, the next line is that. |
post_data->append("Content-Type: " + content_type + "\r\n"); |