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..1f79619e401352f5a070e665410cb9a8f1c85973 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,29 @@ 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. |
- 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; |
} |
+ void OnFileSelected(const FilePath& path); |
+ |
void RecordFileSelected(const FilePath& path); |
scoped_refptr<content::DownloadManager> download_manager_; |
@@ -46,6 +57,8 @@ class DownloadFilePicker : public SelectFileDialog::Listener { |
FilePath suggested_path_; |
+ FileSelectedCallback file_selected_callback_; |
+ |
// For managing select file dialogs. |
scoped_refptr<SelectFileDialog> select_file_dialog_; |