#ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_PICKER_H_
#define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_PICKER_H_
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "chrome/browser/download/download_confirmation_result.h"
#include "components/download/public/common/download_item.h"
#include "ui/shell_dialogs/select_file_dialog.h"
#include "ui/shell_dialogs/selected_file_info.h"
namespace base {
class FilePath;
}
class DownloadFilePicker : public ui::SelectFileDialog::Listener,
public download::DownloadItem::Observer {
public:
using ConfirmationCallback =
base::OnceCallback<void(DownloadConfirmationResult,
const ui::SelectedFileInfo& selected_file_info)>;
DownloadFilePicker(const DownloadFilePicker&) = delete;
DownloadFilePicker& operator=(const DownloadFilePicker&) = delete;
static void ShowFilePicker(download::DownloadItem* item,
const base::FilePath& suggested_path,
ConfirmationCallback callback);
private:
DownloadFilePicker(download::DownloadItem* item,
const base::FilePath& suggested_path,
ConfirmationCallback callback);
~DownloadFilePicker() override;
void FileSelected(const ui::SelectedFileInfo& file, int index) override;
void FileSelectionCanceled() override;
void OnDownloadDestroyed(download::DownloadItem* download) override;
base::FilePath suggested_path_;
ConfirmationCallback file_selected_callback_;
scoped_refptr<ui::SelectFileDialog> select_file_dialog_;
raw_ptr<download::DownloadItem> download_item_;
};
#endif