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

Unified Diff: chrome/browser/extensions/api/downloads/downloads_api.cc

Issue 10915180: Make DownloadHistory observe manager, items (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 3 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
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;
}

Powered by Google App Engine
This is Rietveld 408576698