diff options
author | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-15 07:19:12 +0000 |
---|---|---|
committer | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-15 07:19:12 +0000 |
commit | be2095f9f7d9b27848c2a3937d0fcb9530ee32f2 (patch) | |
tree | 10bb45a6b834cd4f4f71b8009ee52d4efc7fa1d8 /net | |
parent | 40fc7815b1e017cbeb31a7773f4c61bae4677bf6 (diff) | |
download | chromium_src-be2095f9f7d9b27848c2a3937d0fcb9530ee32f2.zip chromium_src-be2095f9f7d9b27848c2a3937d0fcb9530ee32f2.tar.gz chromium_src-be2095f9f7d9b27848c2a3937d0fcb9530ee32f2.tar.bz2 |
We should download text/csv mime types instead of displaying them.
BUG=6079
R=darin
Review URL: http://codereview.chromium.org/18086
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8087 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/base/mime_util.cc | 9 | ||||
-rw-r--r-- | net/base/mime_util_unittest.cc | 5 |
2 files changed, 8 insertions, 6 deletions
diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc index e3ef145..03d09ad 100644 --- a/net/base/mime_util.cc +++ b/net/base/mime_util.cc @@ -242,12 +242,9 @@ bool MimeUtil::IsViewSourceMimeType(const char* mime_type) const { // Mirrors WebViewImpl::CanShowMIMEType() bool MimeUtil::IsSupportedMimeType(const std::string& mime_type) const { - if (mime_type.compare(0, 5, "text/") == 0 || - (mime_type.compare(0, 6, "image/") == 0 && - IsSupportedImageMimeType(mime_type.c_str())) || - IsSupportedNonImageMimeType(mime_type.c_str())) - return true; - return false; + return (mime_type.compare(0, 6, "image/") == 0 && + IsSupportedImageMimeType(mime_type.c_str())) || + IsSupportedNonImageMimeType(mime_type.c_str()); } bool MimeUtil::MatchesMimeType(const std::string &mime_type_pattern, diff --git a/net/base/mime_util_unittest.cc b/net/base/mime_util_unittest.cc index d966005..a49dfe3 100644 --- a/net/base/mime_util_unittest.cc +++ b/net/base/mime_util_unittest.cc @@ -65,6 +65,11 @@ TEST(MimeUtilTest, LookupTypes) { EXPECT_EQ(false, net::IsSupportedImageMimeType("image/lolcat")); EXPECT_EQ(true, net::IsSupportedNonImageMimeType("text/html")); EXPECT_EQ(false, net::IsSupportedNonImageMimeType("text/virus")); + + EXPECT_EQ(true, net::IsSupportedMimeType("image/jpeg")); + EXPECT_EQ(false, net::IsSupportedMimeType("image/lolcat")); + EXPECT_EQ(true, net::IsSupportedMimeType("text/html")); + EXPECT_EQ(false, net::IsSupportedMimeType("text/virus")); } TEST(MimeUtilTest, MatchesMimeType) { |