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

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

Issue 2219953004: Refactor download image-MIME-type-detection code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add more tests 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 cc5f995e554d201ef2db69a8658e33d220a33ff9..e98e7d0ae4a095328ff0bca37e2a15f1455534a0 100644
--- a/chrome/browser/download/notification/download_item_notification.cc
+++ b/chrome/browser/download/notification/download_item_notification.cc
@@ -470,22 +470,7 @@ void DownloadItemNotification::UpdateNotificationData(
image_decode_status_ = IN_PROGRESS;
- 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) {
+ if (model.HasSupportedImageMimeType()) {
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