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

Unified Diff: chrome/browser/download/download_target_determiner.cc

Issue 12662032: Merge SavePackageFilePicker{,ChromeOS} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: @r202870 Created 7 years, 7 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/download/download_target_determiner.cc
diff --git a/chrome/browser/download/download_target_determiner.cc b/chrome/browser/download/download_target_determiner.cc
index 6572846972cec5cb5494a864210745b7dc14a175..c556d3e77059062769f8258469fc93a6da575760 100644
--- a/chrome/browser/download/download_target_determiner.cc
+++ b/chrome/browser/download/download_target_determiner.cc
@@ -59,7 +59,6 @@ DownloadTargetDeterminerDelegate::~DownloadTargetDeterminerDelegate() {
DownloadTargetDeterminer::DownloadTargetDeterminer(
DownloadItem* download,
DownloadPrefs* download_prefs,
- const base::FilePath& last_selected_directory,
DownloadTargetDeterminerDelegate* delegate,
const content::DownloadTargetCallback& callback)
: next_state_(STATE_GENERATE_TARGET_PATH),
@@ -72,7 +71,6 @@ DownloadTargetDeterminer::DownloadTargetDeterminer(
download_(download),
download_prefs_(download_prefs),
delegate_(delegate),
- last_selected_directory_(last_selected_directory),
completion_callback_(callback),
weak_ptr_factory_(this) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -159,11 +157,11 @@ DownloadTargetDeterminer::Result
default_filename);
should_prompt_ = ShouldPromptForDownload(generated_filename);
base::FilePath target_directory;
- if (should_prompt_ && !last_selected_directory_.empty()) {
+ if (should_prompt_) {
DCHECK(!download_prefs_->IsDownloadPathManaged());
// If the user is going to be prompted and the user has been prompted
// before, then always prefer the last directory that the user selected.
- target_directory = last_selected_directory_;
+ target_directory = download_prefs_->SaveFilePath();
} else {
target_directory = download_prefs_->DownloadPath();
}
@@ -284,6 +282,7 @@ void DownloadTargetDeterminer::PromptUserForDownloadPathDone(
return;
}
virtual_path_ = virtual_path;
+ download_prefs_->SetSaveFilePath(virtual_path_.DirName());
DoLoop();
}
@@ -585,14 +584,12 @@ void DownloadTargetDeterminer::OnDownloadDestroyed(
void DownloadTargetDeterminer::Start(
content::DownloadItem* download,
DownloadPrefs* download_prefs,
- const base::FilePath& last_selected_directory,
DownloadTargetDeterminerDelegate* delegate,
const content::DownloadTargetCallback& callback) {
// DownloadTargetDeterminer owns itself and will self destruct when the job is
// complete or the download item is destroyed. The callback is always invoked
// asynchronously.
- new DownloadTargetDeterminer(download, download_prefs,
- last_selected_directory, delegate, callback);
+ new DownloadTargetDeterminer(download, download_prefs, delegate, callback);
}
// static
« no previous file with comments | « chrome/browser/download/download_target_determiner.h ('k') | chrome/browser/download/download_target_determiner_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698