| Index: content/browser/download/save_package.cc
|
| diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc
|
| index 82b4153d9e4cc68de1532869463e143596ab243a..d65c77a93c6745b29bb6869d029c3af16787b1ce 100644
|
| --- a/content/browser/download/save_package.cc
|
| +++ b/content/browser/download/save_package.cc
|
| @@ -1145,6 +1145,8 @@ const FilePath::CharType* SavePackage::ExtensionForMimeType(
|
| }
|
|
|
| void SavePackage::GetSaveInfo() {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| +
|
| // Can't use tab_contents_ in the file thread, so get the data that we need
|
| // before calling to it.
|
| FilePath website_save_dir, download_save_dir;
|
| @@ -1166,17 +1168,15 @@ void SavePackage::CreateDirectoryOnFileThread(
|
| const FilePath& download_save_dir,
|
| const std::string& mime_type,
|
| const std::string& accept_langs) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
|
| +
|
| + FilePath default_downloads_dir =
|
| + download_util::GetDefaultDownloadDirectoryFromPathService();
|
| FilePath save_dir;
|
| - // If the default html/websites save folder doesn't exist...
|
| - if (!file_util::DirectoryExists(website_save_dir)) {
|
| - // If the default download dir doesn't exist, create it.
|
| - if (!file_util::DirectoryExists(download_save_dir))
|
| - file_util::CreateDirectory(download_save_dir);
|
| - save_dir = download_save_dir;
|
| - } else {
|
| - // If it does exist, use the default save dir param.
|
| - save_dir = website_save_dir;
|
| - }
|
| + // Ignores the returned value since the select file dialog should be
|
| + // displayed in any case.
|
| + download_util::ChooseSavableDirectory(
|
| + website_save_dir, download_save_dir, default_downloads_dir, &save_dir);
|
|
|
| bool can_save_as_complete = CanSaveAsComplete(mime_type);
|
| FilePath suggested_filename = GetSuggestedNameForSaveAs(
|
| @@ -1206,6 +1206,8 @@ void SavePackage::CreateDirectoryOnFileThread(
|
|
|
| void SavePackage::ContinueGetSaveInfo(const FilePath& suggested_path,
|
| bool can_save_as_complete) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| +
|
| // The TabContents which owns this SavePackage may have disappeared during
|
| // the UI->FILE->UI thread hop of
|
| // GetSaveInfo->CreateDirectoryOnFileThread->ContinueGetSaveInfo.
|
| @@ -1219,6 +1221,8 @@ void SavePackage::ContinueGetSaveInfo(const FilePath& suggested_path,
|
| // Called after the save file dialog box returns.
|
| void SavePackage::OnPathPicked(const FilePath& final_name,
|
| SavePackageType type) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| +
|
| // Ensure the filename is safe.
|
| saved_main_file_path_ = final_name;
|
| // TODO(asanka): This call may block on IO and shouldn't be made
|
|
|