| Index: chrome/browser/download/download_item_model.cc
|
| diff --git a/chrome/browser/download/download_item_model.cc b/chrome/browser/download/download_item_model.cc
|
| index 95eb7b78040f583635d8244c8e17da461217906c..51ff68dd164c68d76a968a693b490020031937d6 100644
|
| --- a/chrome/browser/download/download_item_model.cc
|
| +++ b/chrome/browser/download/download_item_model.cc
|
| @@ -23,9 +23,11 @@
|
| #include "chrome/common/safe_browsing/download_file_types.pb.h"
|
| #include "chrome/grit/chromium_strings.h"
|
| #include "chrome/grit/generated_resources.h"
|
| +#include "components/mime_util/mime_util.h"
|
| #include "content/public/browser/download_danger_type.h"
|
| #include "content/public/browser/download_interrupt_reasons.h"
|
| #include "content/public/browser/download_item.h"
|
| +#include "net/base/mime_util.h"
|
| #include "ui/base/l10n/l10n_util.h"
|
| #include "ui/base/l10n/time_format.h"
|
| #include "ui/base/text/bytes_formatting.h"
|
| @@ -513,6 +515,23 @@ bool DownloadItemModel::IsMalicious() const {
|
| return false;
|
| }
|
|
|
| +bool DownloadItemModel::HasSupportedImageMimeType() const {
|
| + if (mime_util::IsSupportedImageMimeType(download_->GetMimeType())) {
|
| + return true;
|
| + }
|
| +
|
| + std::string mime;
|
| + base::FilePath::StringType extension_with_dot =
|
| + download_->GetTargetFilePath().FinalExtension();
|
| + if (!extension_with_dot.empty() && net::GetWellKnownMimeTypeFromExtension(
|
| + extension_with_dot.substr(1), &mime) &&
|
| + mime_util::IsSupportedImageMimeType(mime)) {
|
| + return true;
|
| + }
|
| +
|
| + return false;
|
| +}
|
| +
|
| bool DownloadItemModel::ShouldAllowDownloadFeedback() const {
|
| #if defined(FULL_SAFE_BROWSING)
|
| if (!IsDangerous())
|
|
|