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

Unified Diff: net/base/mime_util.cc

Issue 471913002: Added a method to detect all supported "image/*" MIME types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
« no previous file with comments | « net/base/mime_util.h ('k') | net/base/mime_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/mime_util.cc
diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc
index 7dd51a2945d4556a6ce45f858546e9c60ba8af69..e2b8d1cd93cd4262bbc0906010b79cd97770399f 100644
--- a/net/base/mime_util.cc
+++ b/net/base/mime_util.cc
@@ -82,6 +82,7 @@ class MimeUtil : public PlatformMimeUtil {
bool IsSupportedImageMimeType(const std::string& mime_type) const;
bool IsSupportedMediaMimeType(const std::string& mime_type) const;
bool IsSupportedNonImageMimeType(const std::string& mime_type) const;
+ bool IsSupportedImagePrefixedMimeType(const std::string& mime_type) const;
bool IsUnsupportedTextMimeType(const std::string& mime_type) const;
bool IsSupportedJavascriptMimeType(const std::string& mime_type) const;
@@ -727,6 +728,12 @@ bool MimeUtil::IsSupportedMimeType(const std::string& mime_type) const {
IsSupportedNonImageMimeType(mime_type);
}
+bool MimeUtil::IsSupportedImagePrefixedMimeType(
+ const std::string& mime_type) const {
+ return (mime_type.compare(0, 6, "image/") == 0 &&
+ (IsSupportedImageMimeType(mime_type) ||
+ IsSupportedNonImageMimeType(mime_type)));
Ryan Sleevi 2014/08/22 23:08:35 This doesn't really make sense to me.
Ryan Sleevi 2014/08/23 05:09:45 What I specifically mean is that you check for the
+}
// Tests for MIME parameter equality. Each parameter in the |mime_type_pattern|
// must be matched by a parameter in the |mime_type|. If there are no
// parameters in the pattern, the match is a success.
@@ -1080,6 +1087,10 @@ bool IsSupportedNonImageMimeType(const std::string& mime_type) {
return g_mime_util.Get().IsSupportedNonImageMimeType(mime_type);
}
+bool IsSupportedImagePrefixedMimeType(const std::string& mime_type) {
+ return g_mime_util.Get().IsSupportedImagePrefixedMimeType(mime_type);
+}
+
bool IsUnsupportedTextMimeType(const std::string& mime_type) {
return g_mime_util.Get().IsUnsupportedTextMimeType(mime_type);
}
« no previous file with comments | « net/base/mime_util.h ('k') | net/base/mime_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698