Chromium Code Reviews| Index: chrome/browser/download/download_file_picker.h |
| diff --git a/chrome/browser/download/download_file_picker.h b/chrome/browser/download/download_file_picker.h |
| index d6bf0c30684a8bcd2c0ea0c398c8bbe0ad06e032..f50b4fbc5a3c0329ea44b0c5ea092585e834e508 100644 |
| --- a/chrome/browser/download/download_file_picker.h |
| +++ b/chrome/browser/download/download_file_picker.h |
| @@ -6,6 +6,7 @@ |
| #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_PICKER_H_ |
| #pragma once |
| +#include "base/callback.h" |
| #include "chrome/browser/ui/select_file_dialog.h" |
| class FilePath; |
| @@ -19,19 +20,30 @@ class WebContents; |
| // Handles showing a dialog to the user to ask for the filename for a download. |
| class DownloadFilePicker : public SelectFileDialog::Listener { |
| public: |
| + // Callback invoked when the user chooses a download path. If the user cancels |
| + // the operation, |selected_path| will be empty. |
| + typedef base::Callback<void(const FilePath& selected_path)> |
| + FileSelectedCallback; |
| + |
| DownloadFilePicker(); |
| virtual ~DownloadFilePicker(); |
| void Init(content::DownloadManager* download_manager, |
| - content::DownloadItem* item); |
| + content::DownloadItem* item, |
| + const FilePath& suggested_path, |
| + const FileSelectedCallback& callback); |
| protected: |
| // On ChromeOS, DownloadItem::GetTargetPath is a temporary local filename. |
|
Randy Smith (Not in Mondays)
2012/07/12 17:01:22
I don't see the relationship of this comment to th
asanka
2012/07/18 21:50:56
It was stale. Fixed.
|
| - virtual void InitSuggestedPath(content::DownloadItem* item); |
| + virtual void InitSuggestedPath(content::DownloadItem* item, |
| + const FilePath& suggested_path); |
| void set_suggested_path(const FilePath& suggested_path) { |
| suggested_path_ = suggested_path; |
| } |
| + // Runs |file_selected_callback_| with |path| and then deletes this object. |
| + void OnFileSelected(const FilePath& path); |
| + |
| void RecordFileSelected(const FilePath& path); |
| scoped_refptr<content::DownloadManager> download_manager_; |
| @@ -46,6 +58,8 @@ class DownloadFilePicker : public SelectFileDialog::Listener { |
| FilePath suggested_path_; |
| + FileSelectedCallback file_selected_callback_; |
| + |
| // For managing select file dialogs. |
| scoped_refptr<SelectFileDialog> select_file_dialog_; |