Index: chrome/browser/extensions/api/downloads/downloads_api.cc |
diff --git a/chrome/browser/extensions/api/downloads/downloads_api.cc b/chrome/browser/extensions/api/downloads/downloads_api.cc |
index f2394a1a2efe6e2a8332ff74a435bd29fe3d9d9f..7b10c9eb7b049cc91f3ca43e5172538f010bea94 100644 |
--- a/chrome/browser/extensions/api/downloads/downloads_api.cc |
+++ b/chrome/browser/extensions/api/downloads/downloads_api.cc |
@@ -860,22 +860,18 @@ bool DownloadsGetFileIconFunction::RunImpl() { |
DownloadItem* download_item = manager->GetDownload(params->download_id); |
if (!download_item && incognito_manager) |
download_item = incognito_manager->GetDownload(params->download_id); |
- if (!download_item) { |
- // The DownloadItem is is added to history when the path is determined. If |
- // the download is not in history, then we don't have a path / final |
- // filename and no icon. |
+ if (!download_item || download_item->GetTargetFilePath().empty()) { |
error_ = download_extension_errors::kInvalidOperationError; |
return false; |
} |
// In-progress downloads return the intermediate filename for GetFullPath() |
// which doesn't have the final extension. Therefore we won't be able to |
// derive a good file icon for it. So we use GetTargetFilePath() instead. |
- FilePath path = download_item->GetTargetFilePath(); |
- DCHECK(!path.empty()); |
DCHECK(icon_extractor_.get()); |
DCHECK(icon_size == 16 || icon_size == 32); |
EXTENSION_FUNCTION_VALIDATE(icon_extractor_->ExtractIconURLForPath( |
- path, IconLoaderSizeFromPixelSize(icon_size), |
+ download_item->GetTargetFilePath(), |
+ IconLoaderSizeFromPixelSize(icon_size), |
base::Bind(&DownloadsGetFileIconFunction::OnIconURLExtracted, this))); |
return true; |
} |