| 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..682af7d54332f820036b7f35ef1c832c30a16a78 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,10 @@ 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(&DownloadFilePickerChromeOS::OnFileSelected,
|
| + base::Unretained(this)));
|
| + } else {
|
| + OnFileSelected(FilePath());
|
| }
|
| - delete this;
|
| + // The OnFileSelected() call deletes |this|
|
| }
|
|
|