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

Unified Diff: content/shell/shell_download_manager_delegate.cc

Issue 10704052: Download filename determination refactor (3/3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use a callback with DetermineDownloadTarget(). Created 8 years, 5 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: content/shell/shell_download_manager_delegate.cc
diff --git a/content/shell/shell_download_manager_delegate.cc b/content/shell/shell_download_manager_delegate.cc
index 2bb5425f54f1c0aa8979b626aa5d80846e18d997..ed63d27c5c9286e4cad6bc0d62e5e8cf3aff2c33 100644
--- a/content/shell/shell_download_manager_delegate.cc
+++ b/content/shell/shell_download_manager_delegate.cc
@@ -90,16 +90,14 @@ void ShellDownloadManagerDelegate::RestartDownload(
return;
// Since we have no download UI, show the user a dialog always.
- download->OnTargetPathDetermined(suggested_path,
- DownloadItem::TARGET_DISPOSITION_PROMPT,
- content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
- download_manager_->RestartDownload(download_id);
+ ChooseDownloadPath(download, suggested_path);
Randy Smith (Not in Mondays) 2012/07/10 18:33:09 Any reason not to hoist the code in ChooseDownload
asanka 2012/07/11 20:03:32 I left it out since we might need to override it f
}
-void ShellDownloadManagerDelegate::ChooseDownloadPath(DownloadItem* item) {
+void ShellDownloadManagerDelegate::ChooseDownloadPath(
+ DownloadItem* item,
+ const FilePath& suggested_path) {
FilePath result;
#if defined(OS_WIN) && !defined(USE_AURA)
- const FilePath suggested_path(item->GetTargetFilePath());
std::wstring file_part = FilePath(suggested_path).BaseName().value();
wchar_t file_name[MAX_PATH];
base::wcslcpy(file_name, file_part.c_str(), arraysize(file_name));
@@ -125,9 +123,12 @@ void ShellDownloadManagerDelegate::ChooseDownloadPath(DownloadItem* item) {
#endif
if (result.empty()) {
- download_manager_->FileSelectionCanceled(item->GetId());
+ item->Cancel(true);
} else {
- download_manager_->FileSelected(result, item->GetId());
+ item->OnTargetPathDetermined(result,
+ DownloadItem::TARGET_DISPOSITION_PROMPT,
+ content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
+ download_manager_->RestartDownload(download_id);
}
}

Powered by Google App Engine
This is Rietveld 408576698