Chromium Code Reviews| 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 e4cc721dde93ab4c8fdf3ce47386cf429b176540..96f68379a00e113dfa6cdf1b0d2ff5472339e69c 100644 |
| --- a/chrome/browser/extensions/api/downloads/downloads_api.cc |
| +++ b/chrome/browser/extensions/api/downloads/downloads_api.cc |
| @@ -855,7 +855,7 @@ 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) { |
| + if (!download_item || download_item->GetTargetFilePath().empty()) { |
| // The DownloadItem is is added to history when the path is determined. If |
|
Randy Smith (Not in Mondays)
2012/09/24 18:03:25
Is this comment still accurate?
benjhayden
2012/09/24 20:12:11
Nope. Deleted.
chrome.downloads.onCreated is fired
|
| // the download is not in history, then we don't have a path / final |
| // filename and no icon. |
| @@ -865,12 +865,11 @@ bool DownloadsGetFileIconFunction::RunImpl() { |
| // 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; |
| } |