| 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..1532582d435593237062d1e0ec6202a71f0d774a 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,48 +21,51 @@ 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();
|
| - 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.
|
| - virtual void InitSuggestedPath(content::DownloadItem* item,
|
| - const base::FilePath& suggested_path);
|
| -
|
| - void set_suggested_path(const base::FilePath& suggested_path) {
|
| - suggested_path_ = suggested_path;
|
| - }
|
| -
|
| - // Runs |file_selected_callback_| with |path| and then deletes this object.
|
| - void OnFileSelected(const base::FilePath& path);
|
| + // Callback used to pass the user selection back to the owner of this
|
| + // object.
|
| + // |virtual_path|: The path chosen by the user. If the user cancels the file
|
| + // selection, then this parameter will be the empty path. On Chrome OS,
|
| + // this path may contain virtual mount points if the user chose a virtual
|
| + // path (e.g. Google Drive).
|
| + typedef base::Callback<void(const base::FilePath& virtual_path)>
|
| + FileSelectedCallback;
|
| +
|
| + // Display a file picker dialog for |item|. The |suggested_path| will be used
|
| + // as the initial path displayed to the user. |callback| will always be
|
| + // invoked even if |item| is destroyed prior to the file picker completing.
|
| + static void ShowFilePicker(content::DownloadItem* item,
|
| + const base::FilePath& suggested_path,
|
| + const FileSelectedCallback& callback);
|
|
|
| - void RecordFileSelected(const base::FilePath& path);
|
| + private:
|
| + DownloadFilePicker(content::DownloadItem* item,
|
| + const base::FilePath& suggested_path,
|
| + const FileSelectedCallback& callback);
|
| + virtual ~DownloadFilePicker();
|
|
|
| - scoped_refptr<content::DownloadManager> download_manager_;
|
| - int32 download_id_;
|
| + // Runs |file_selected_callback_| with |virtual_path| and then deletes this
|
| + // object.
|
| + void OnFileSelected(const base::FilePath& virtual_path);
|
|
|
| - private:
|
| // SelectFileDialog::Listener implementation.
|
| virtual void FileSelected(const base::FilePath& path,
|
| int index,
|
| void* params) OVERRIDE;
|
| virtual void FileSelectionCanceled(void* params) OVERRIDE;
|
|
|
| + // Initially suggested path.
|
| base::FilePath suggested_path_;
|
|
|
| - ChromeDownloadManagerDelegate::FileSelectedCallback file_selected_callback_;
|
| + // Callback invoked when a file selection is complete.
|
| + FileSelectedCallback file_selected_callback_;
|
|
|
| // For managing select file dialogs.
|
| scoped_refptr<ui::SelectFileDialog> select_file_dialog_;
|
|
|
| + // True if UMA regarding on the result of the file selection should be
|
| + // recorded.
|
| + bool should_record_file_picker_result_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(DownloadFilePicker);
|
| };
|
|
|
|
|