| 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 b7dc8b42f4c78cb1f277fa33b551f4cb805cb582..be27c9237106db151b1320da7370646738a12964 100644
|
| --- a/chrome/browser/download/download_file_picker.h
|
| +++ b/chrome/browser/download/download_file_picker.h
|
| @@ -5,7 +5,7 @@
|
| #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_PICKER_H_
|
| #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_PICKER_H_
|
|
|
| -#include "chrome/browser/download/chrome_download_manager_delegate.h"
|
| +#include "base/callback.h"
|
| #include "ui/shell_dialogs/select_file_dialog.h"
|
|
|
| namespace base {
|
| @@ -21,16 +21,27 @@ class WebContents;
|
| // Handles showing a dialog to the user to ask for the filename for a download.
|
| class DownloadFilePicker : public ui::SelectFileDialog::Listener {
|
| public:
|
| - DownloadFilePicker();
|
| + // Callback used to pass the user selection back to the owner of this
|
| + // object. If the user selection is successful, the arguments will be as
|
| + // follows:
|
| + // |virtual_path|: The opaque path representing the virtual target chosen by
|
| + // the user. If the target is local file system, then this will be same as
|
| + // |local_path|.
|
| + // |local_path|: The path on the local file system to use for storing the
|
| + // downloaded file.
|
| + //
|
| + // If the path selection is successful, both paths will be non-empty and
|
| + // valid. Otherwise, if the user cancels the selection, both paths will be
|
| + // empty.
|
| + typedef base::Callback<void(
|
| + const base::FilePath& virtual_path,
|
| + const base::FilePath& local_path)> FileSelectedCallback;
|
| +
|
| + DownloadFilePicker(content::DownloadItem* item,
|
| + const base::FilePath& suggested_path,
|
| + const FileSelectedCallback& callback);
|
| virtual ~DownloadFilePicker();
|
|
|
| - void Init(content::DownloadManager* download_manager,
|
| - content::DownloadItem* item,
|
| - const base::FilePath& suggested_path,
|
| - const ChromeDownloadManagerDelegate::FileSelectedCallback&
|
| - callback);
|
| -
|
| - protected:
|
| // On ChromeOS |suggested_path| might be a temporary local filename. This
|
| // method should be overridden to set the correct suggested path to prompt the
|
| // user.
|
| @@ -41,8 +52,10 @@ class DownloadFilePicker : public ui::SelectFileDialog::Listener {
|
| suggested_path_ = suggested_path;
|
| }
|
|
|
| - // Runs |file_selected_callback_| with |path| and then deletes this object.
|
| - void OnFileSelected(const base::FilePath& path);
|
| + // Runs |file_selected_callback_| with |virtual_path| and |local_path| and
|
| + // then deletes this object.
|
| + void OnFileSelected(const base::FilePath& virtual_path,
|
| + const base::FilePath& local_path);
|
|
|
| void RecordFileSelected(const base::FilePath& path);
|
|
|
| @@ -58,7 +71,7 @@ class DownloadFilePicker : public ui::SelectFileDialog::Listener {
|
|
|
| base::FilePath suggested_path_;
|
|
|
| - ChromeDownloadManagerDelegate::FileSelectedCallback file_selected_callback_;
|
| + FileSelectedCallback file_selected_callback_;
|
|
|
| // For managing select file dialogs.
|
| scoped_refptr<ui::SelectFileDialog> select_file_dialog_;
|
| @@ -66,4 +79,12 @@ class DownloadFilePicker : public ui::SelectFileDialog::Listener {
|
| DISALLOW_COPY_AND_ASSIGN(DownloadFilePicker);
|
| };
|
|
|
| +class DownloadFilePickerFactory {
|
| + public:
|
| + virtual ~DownloadFilePickerFactory();
|
| + virtual void Create(content::DownloadItem* item,
|
| + const base::FilePath& suggested_path,
|
| + const DownloadFilePicker::FileSelectedCallback& callback);
|
| +};
|
| +
|
| #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_PICKER_H_
|
|
|