Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6302)

Unified Diff: chrome/browser/download/download_file_picker.h

Issue 12850002: Move download filename determintion into a separate class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..32fb1edf4705e30686900d2320d17552429bda70 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,23 @@ 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();
+ // Callback used to pass the selected path back to the owner of this
+ // object. The callback will be invoked with the user-selected path as the
+ // argument. If the file selection is canceled, the argument will be the empty
+ // path.
+ typedef base::Callback<void(const base::FilePath&,
+ const base::FilePath&)> FileSelectedCallback;
- void Init(content::DownloadManager* download_manager,
- content::DownloadItem* item,
- const base::FilePath& suggested_path,
- const ChromeDownloadManagerDelegate::FileSelectedCallback&
- callback);
+ static void ShowFilePicker(content::DownloadItem* item,
+ const base::FilePath& suggested_path,
+ const FileSelectedCallback& callback);
protected:
+ DownloadFilePicker(content::DownloadItem* item,
+ const base::FilePath& suggested_path,
+ const FileSelectedCallback& callback);
+ virtual ~DownloadFilePicker();
+
// 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 +48,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 +67,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_;

Powered by Google App Engine
This is Rietveld 408576698