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

Unified Diff: net/base/mime_util.cc

Issue 228823003: Adding check for MIME types that do not take codecs parameter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: net/base/mime_util.cc
diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc
index 4679dcc02e06e94a52641e6f388088eec5f9f313..9c8e8931b819b924c3e150cc36494303750d4bd8 100644
--- a/net/base/mime_util.cc
+++ b/net/base/mime_util.cc
@@ -82,6 +82,8 @@ class MimeUtil : public PlatformMimeUtil {
const std::string& mime_type,
const std::vector<std::string>& codecs) const;
+ bool MimeTypeDoesNotNeedCodecs(const std::string& mime_type) const;
+
void RemoveProprietaryMediaTypesAndCodecsForTests();
private:
@@ -438,7 +440,10 @@ static const MediaFormatStrict format_codec_mappings[] = {
{ "audio/x-wav", "1" },
{ "video/ogg", "opus,theora,vorbis" },
{ "audio/ogg", "opus,vorbis" },
- { "application/ogg", "opus,theora,vorbis" }
+ { "application/ogg", "opus,theora,vorbis" },
+ { "audio/mpeg", "" },
+ { "audio/mp3", "" },
+ { "audio/x-mp3", "" }
};
MimeUtil::MimeUtil() {
@@ -710,6 +715,11 @@ bool MimeUtil::IsSupportedStrictMediaMimeType(
AreSupportedCodecs(it->second, codecs);
}
+bool MimeUtil::MimeTypeDoesNotNeedCodecs(const std::string& mime_type) const {
+ StrictMappings::const_iterator it = strict_format_map_.find(mime_type);
+ return (it != strict_format_map_.end()) && it->second.empty();
+}
+
void MimeUtil::RemoveProprietaryMediaTypesAndCodecsForTests() {
for (size_t i = 0; i < arraysize(proprietary_media_types); ++i) {
non_image_map_.erase(proprietary_media_types[i]);
@@ -790,6 +800,10 @@ bool IsSupportedStrictMediaMimeType(const std::string& mime_type,
return g_mime_util.Get().IsSupportedStrictMediaMimeType(mime_type, codecs);
}
+bool MimeTypeDoesNotNeedCodecs(const std::string& mime_type) {
+ return g_mime_util.Get().MimeTypeDoesNotNeedCodecs(mime_type);
+}
+
void ParseCodecString(const std::string& codecs,
std::vector<std::string>* codecs_out,
const bool strip) {

Powered by Google App Engine
This is Rietveld 408576698