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

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

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_chromeos.cc
diff --git a/chrome/browser/download/download_file_picker_chromeos.cc b/chrome/browser/download/download_file_picker_chromeos.cc
index 695c71998160c882c96088b0edea60605935df3b..52913d27f41920fdf0367f6e2ac7925f4f619ef5 100644
--- a/chrome/browser/download/download_file_picker_chromeos.cc
+++ b/chrome/browser/download/download_file_picker_chromeos.cc
@@ -14,31 +14,21 @@
using content::DownloadItem;
using content::DownloadManager;
-namespace {
-
-// Call FileSelected on |download_manager|.
-void FileSelectedHelper(DownloadManager* download_manager,
- int32 download_id,
- const FilePath& file_path) {
- download_manager->FileSelected(file_path, download_id);
-}
-
-} // namespace
-
DownloadFilePickerChromeOS::DownloadFilePickerChromeOS() {
}
DownloadFilePickerChromeOS::~DownloadFilePickerChromeOS() {
}
-void DownloadFilePickerChromeOS::InitSuggestedPath(DownloadItem* item) {
- // For GData downloads, suggested path is the virtual gdata path instead of
- // the temporary local one.
+void DownloadFilePickerChromeOS::InitSuggestedPath(DownloadItem* item,
+ const FilePath& path) {
+ // For GData downloads, |path| is the virtual gdata path instead of the
+ // temporary local one.
if (gdata::GDataDownloadObserver::IsGDataDownload(item)) {
set_suggested_path(gdata::util::GetSpecialRemoteRootPath().Append(
gdata::GDataDownloadObserver::GetGDataPath(item)));
} else {
- DownloadFilePicker::InitSuggestedPath(item);
+ DownloadFilePicker::InitSuggestedPath(item, path);
}
}
@@ -48,6 +38,8 @@ void DownloadFilePickerChromeOS::FileSelected(const FilePath& selected_path,
FilePath path = selected_path;
file_util::NormalizeFileNameEncoding(&path);
+ // Need to do this before we substitute with a temporary path. Otherwise we
+ // won't be able to detect path changes.
RecordFileSelected(path);
if (download_manager_) {
@@ -55,7 +47,7 @@ void DownloadFilePickerChromeOS::FileSelected(const FilePath& selected_path,
download_manager_->GetActiveDownloadItem(download_id_);
gdata::GDataDownloadObserver::SubstituteGDataDownloadPath(
NULL, path, download,
- base::Bind(&FileSelectedHelper, download_manager_, download_id_));
+ base::Bind(&DownloadFilePicker::OnFileSelected,
+ base::Unretained(this)));
}
- delete this;
}

Powered by Google App Engine
This is Rietveld 408576698