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

Unified Diff: chrome/browser/download/download_file_picker_chromeos.cc

Issue 12850002: Move download filename determintion into a separate class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments 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_chromeos.cc
diff --git a/chrome/browser/download/download_file_picker_chromeos.cc b/chrome/browser/download/download_file_picker_chromeos.cc
index 0991285aaba02b15c0df1d97e12b0bdb8c5b6f3a..a8f200d68e207914baf27d4d8b2935731ea56fc7 100644
--- a/chrome/browser/download/download_file_picker_chromeos.cc
+++ b/chrome/browser/download/download_file_picker_chromeos.cc
@@ -15,7 +15,11 @@
using content::DownloadItem;
using content::DownloadManager;
-DownloadFilePickerChromeOS::DownloadFilePickerChromeOS() {
+DownloadFilePickerChromeOS::DownloadFilePickerChromeOS(
+ DownloadItem* item,
+ const base::FilePath& suggested_path,
+ const FileSelectedCallback& callback)
+ : DownloadFilePicker(item, suggested_path, callback) {
}
DownloadFilePickerChromeOS::~DownloadFilePickerChromeOS() {
@@ -57,6 +61,8 @@ void DownloadFilePickerChromeOS::FileSelectedWithExtraInfo(
// won't be able to detect path changes.
RecordFileSelected(path);
+ // TODO(asanka): Eliminate this substitution and rely on the local path
+ // determination in DownloadTargetDeterminer.
if (download_manager_) {
Profile* profile =
Profile::FromBrowserContext(download_manager_->GetBrowserContext());
@@ -67,12 +73,21 @@ void DownloadFilePickerChromeOS::FileSelectedWithExtraInfo(
drive_download_handler->SubstituteDriveDownloadPath(
path, download,
base::Bind(&DownloadFilePickerChromeOS::OnFileSelected,
- base::Unretained(this)));
+ base::Unretained(this), path));
} else {
- OnFileSelected(path);
+ OnFileSelected(path, path);
}
} else {
- OnFileSelected(base::FilePath());
+ OnFileSelected(base::FilePath(), base::FilePath());
}
// The OnFileSelected() call deletes |this|
}
+
+// static
+void DownloadFilePickerFactory::Create(
+ DownloadItem* item,
+ const base::FilePath& suggested_path,
+ const DownloadFilePicker::FileSelectedCallback& callback) {
+ new DownloadFilePickerChromeOS(item, suggested_path, callback);
+ // DownloadFilePickerChromeOS deletes itself.
+}

Powered by Google App Engine
This is Rietveld 408576698