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

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: Merge with r148594 to and resolve conflicts with r148576 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
« no previous file with comments | « chrome/browser/download/download_file_picker_chromeos.h ('k') | chrome/browser/download/download_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 56f070a495f55979e639c3919f08571b4693b9f2..03bbcd58771559eeae2c158d5c86ee497c1b7686 100644
--- a/chrome/browser/download/download_file_picker_chromeos.cc
+++ b/chrome/browser/download/download_file_picker_chromeos.cc
@@ -15,31 +15,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);
}
}
@@ -59,6 +49,8 @@ void DownloadFilePickerChromeOS::FileSelectedWithExtraInfo(
FilePath path = file_info.file_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_) {
@@ -66,7 +58,10 @@ void DownloadFilePickerChromeOS::FileSelectedWithExtraInfo(
download_manager_->GetActiveDownloadItem(download_id_);
gdata::GDataDownloadObserver::SubstituteGDataDownloadPath(
NULL, path, download,
- base::Bind(&FileSelectedHelper, download_manager_, download_id_));
+ base::Bind(&DownloadFilePickerChromeOS::OnFileSelected,
+ base::Unretained(this)));
+ } else {
+ OnFileSelected(FilePath());
}
- delete this;
+ // The OnFileSelected() call deletes |this|
}
« no previous file with comments | « chrome/browser/download/download_file_picker_chromeos.h ('k') | chrome/browser/download/download_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698