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

Unified Diff: chrome/browser/download/notification/download_item_notification.cc

Issue 2221113003: Revert of Refactor download image-MIME-type-detection code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | « chrome/browser/download/download_item_model_unittest.cc ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/notification/download_item_notification.cc
diff --git a/chrome/browser/download/notification/download_item_notification.cc b/chrome/browser/download/notification/download_item_notification.cc
index e98e7d0ae4a095328ff0bca37e2a15f1455534a0..cc5f995e554d201ef2db69a8658e33d220a33ff9 100644
--- a/chrome/browser/download/notification/download_item_notification.cc
+++ b/chrome/browser/download/notification/download_item_notification.cc
@@ -470,7 +470,22 @@
image_decode_status_ = IN_PROGRESS;
- if (model.HasSupportedImageMimeType()) {
+ bool maybe_image = false;
+ if (mime_util::IsSupportedImageMimeType(item_->GetMimeType())) {
+ maybe_image = true;
+ } else {
+ std::string mime;
+ base::FilePath::StringType extension_with_dot =
+ item_->GetTargetFilePath().FinalExtension();
+ if (!extension_with_dot.empty() &&
+ net::GetWellKnownMimeTypeFromExtension(extension_with_dot.substr(1),
+ &mime) &&
+ mime_util::IsSupportedImageMimeType(mime)) {
+ maybe_image = true;
+ }
+ }
+
+ if (maybe_image) {
base::FilePath file_path = item_->GetFullPath();
base::PostTaskAndReplyWithResult(
content::BrowserThread::GetBlockingPool(), FROM_HERE,
« no previous file with comments | « chrome/browser/download/download_item_model_unittest.cc ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698