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

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

Issue 10704052: Download filename determination refactor (3/3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: BrowsingDataRemover calls CDMD directly Created 8 years, 5 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 d6bf0c30684a8bcd2c0ea0c398c8bbe0ad06e032..f50b4fbc5a3c0329ea44b0c5ea092585e834e508 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,30 @@ 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.
Randy Smith (Not in Mondays) 2012/07/12 17:01:22 I don't see the relationship of this comment to th
asanka 2012/07/18 21:50:56 It was stale. Fixed.
- 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;
}
+ // Runs |file_selected_callback_| with |path| and then deletes this object.
+ void OnFileSelected(const FilePath& path);
+
void RecordFileSelected(const FilePath& path);
scoped_refptr<content::DownloadManager> download_manager_;
@@ -46,6 +58,8 @@ class DownloadFilePicker : public SelectFileDialog::Listener {
FilePath suggested_path_;
+ FileSelectedCallback file_selected_callback_;
+
// For managing select file dialogs.
scoped_refptr<SelectFileDialog> select_file_dialog_;

Powered by Google App Engine
This is Rietveld 408576698