| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/download/download_file_picker_chromeos.h" | 5 #include "chrome/browser/download/download_file_picker_chromeos.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/i18n/file_util_icu.h" | 8 #include "base/i18n/file_util_icu.h" |
| 9 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" | 9 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" |
| 10 #include "chrome/browser/chromeos/gdata/gdata_util.h" | 10 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
| 11 #include "content/public/browser/download_item.h" | 11 #include "content/public/browser/download_item.h" |
| 12 #include "content/public/browser/download_manager.h" | 12 #include "content/public/browser/download_manager.h" |
| 13 #include "ui/base/dialogs/selected_file_info.h" |
| 13 | 14 |
| 14 using content::DownloadItem; | 15 using content::DownloadItem; |
| 15 using content::DownloadManager; | 16 using content::DownloadManager; |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| 19 // Call FileSelected on |download_manager|. | 20 // Call FileSelected on |download_manager|. |
| 20 void FileSelectedHelper(DownloadManager* download_manager, | 21 void FileSelectedHelper(DownloadManager* download_manager, |
| 21 int32 download_id, | 22 int32 download_id, |
| 22 const FilePath& file_path) { | 23 const FilePath& file_path) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 38 set_suggested_path(gdata::util::GetSpecialRemoteRootPath().Append( | 39 set_suggested_path(gdata::util::GetSpecialRemoteRootPath().Append( |
| 39 gdata::GDataDownloadObserver::GetGDataPath(item))); | 40 gdata::GDataDownloadObserver::GetGDataPath(item))); |
| 40 } else { | 41 } else { |
| 41 DownloadFilePicker::InitSuggestedPath(item); | 42 DownloadFilePicker::InitSuggestedPath(item); |
| 42 } | 43 } |
| 43 } | 44 } |
| 44 | 45 |
| 45 void DownloadFilePickerChromeOS::FileSelected(const FilePath& selected_path, | 46 void DownloadFilePickerChromeOS::FileSelected(const FilePath& selected_path, |
| 46 int index, | 47 int index, |
| 47 void* params) { | 48 void* params) { |
| 48 FilePath path = selected_path; | 49 FileSelectedWithExtraInfo( |
| 50 ui::SelectedFileInfo(selected_path, selected_path), |
| 51 index, |
| 52 params); |
| 53 } |
| 54 |
| 55 void DownloadFilePickerChromeOS::FileSelectedWithExtraInfo( |
| 56 const ui::SelectedFileInfo& file_info, |
| 57 int index, |
| 58 void* params) { |
| 59 FilePath path = file_info.file_path; |
| 49 file_util::NormalizeFileNameEncoding(&path); | 60 file_util::NormalizeFileNameEncoding(&path); |
| 50 | 61 |
| 51 RecordFileSelected(path); | 62 RecordFileSelected(path); |
| 52 | 63 |
| 53 if (download_manager_) { | 64 if (download_manager_) { |
| 54 content::DownloadItem* download = | 65 content::DownloadItem* download = |
| 55 download_manager_->GetActiveDownloadItem(download_id_); | 66 download_manager_->GetActiveDownloadItem(download_id_); |
| 56 gdata::GDataDownloadObserver::SubstituteGDataDownloadPath( | 67 gdata::GDataDownloadObserver::SubstituteGDataDownloadPath( |
| 57 NULL, path, download, | 68 NULL, path, download, |
| 58 base::Bind(&FileSelectedHelper, download_manager_, download_id_)); | 69 base::Bind(&FileSelectedHelper, download_manager_, download_id_)); |
| 59 } | 70 } |
| 60 delete this; | 71 delete this; |
| 61 } | 72 } |
| OLD | NEW |