Index: chrome/browser/download/download_file_picker.cc |
diff --git a/chrome/browser/download/download_file_picker.cc b/chrome/browser/download/download_file_picker.cc |
index c115cab2da8e40b4c35c470c1ed340da72366f49..ff0c20673b403a356f0c76fa2e4eb49e3fc57a2d 100644 |
--- a/chrome/browser/download/download_file_picker.cc |
+++ b/chrome/browser/download/download_file_picker.cc |
@@ -59,10 +59,13 @@ DownloadFilePicker::DownloadFilePicker() : download_id_(0) { |
} |
void DownloadFilePicker::Init(DownloadManager* download_manager, |
- DownloadItem* item) { |
+ DownloadItem* item, |
+ const FilePath& suggested_path, |
+ const FileSelectedCallback& callback) { |
download_manager_ = download_manager; |
download_id_ = item->GetId(); |
- InitSuggestedPath(item); |
+ file_selected_callback_ = callback; |
+ InitSuggestedPath(item, suggested_path); |
DCHECK(download_manager_); |
WebContents* web_contents = item->GetWebContents(); |
@@ -93,8 +96,14 @@ void DownloadFilePicker::Init(DownloadManager* download_manager, |
DownloadFilePicker::~DownloadFilePicker() { |
} |
-void DownloadFilePicker::InitSuggestedPath(DownloadItem* item) { |
- set_suggested_path(item->GetTargetFilePath()); |
+void DownloadFilePicker::InitSuggestedPath(DownloadItem* item, |
+ const FilePath& suggested_path) { |
+ set_suggested_path(suggested_path); |
+} |
+ |
+void DownloadFilePicker::OnFileSelected(const FilePath& path) { |
+ file_selected_callback_.Run(path); |
+ delete this; |
} |
void DownloadFilePicker::RecordFileSelected(const FilePath& path) { |
@@ -106,15 +115,10 @@ void DownloadFilePicker::FileSelected(const FilePath& path, |
int index, |
void* params) { |
RecordFileSelected(path); |
- |
- if (download_manager_) |
- download_manager_->FileSelected(path, download_id_); |
- delete this; |
+ OnFileSelected(path); |
} |
void DownloadFilePicker::FileSelectionCanceled(void* params) { |
RecordFilePickerResult(download_manager_, FILE_PICKER_CANCEL); |
- if (download_manager_) |
- download_manager_->FileSelectionCanceled(download_id_); |
- delete this; |
+ OnFileSelected(FilePath()); |
} |