| Index: chrome/browser/download/download_manager.cc
|
| diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc
|
| index fe4a46330bea3f550a6f88bf411f5a3bb49a40a8..6c59de905e17459006ff5609a84667f67c9cae6d 100644
|
| --- a/chrome/browser/download/download_manager.cc
|
| +++ b/chrome/browser/download/download_manager.cc
|
| @@ -640,7 +640,8 @@ void DownloadManager::StartDownload(DownloadCreateInfo* info) {
|
| DCHECK(info);
|
|
|
| // Check whether this download is for an extension install or not.
|
| - if (!info->save_as) { // Allow extensions to be explicitly saved.
|
| + // Allow extensions to be explicitly saved.
|
| + if (!info->prompt_user_for_save_location) {
|
| if (UserScript::HasUserScriptFileExtension(info->url) ||
|
| info->mime_type == Extension::kMimeType)
|
| info->is_extension_install = true;
|
| @@ -657,7 +658,7 @@ void DownloadManager::StartDownload(DownloadCreateInfo* info) {
|
| // 2) Drag-out download. Since we will save to the destination folder that
|
| // is dropped to, we should not pop up a Save As dialog.
|
| if (!info->is_extension_install && info->save_info.file_path.empty())
|
| - info->save_as = true;
|
| + info->prompt_user_for_save_location = true;
|
| }
|
|
|
| if (info->save_info.file_path.empty()) {
|
| @@ -666,7 +667,7 @@ void DownloadManager::StartDownload(DownloadCreateInfo* info) {
|
| // 2) prompting the user.
|
| FilePath generated_name;
|
| GenerateFileNameFromInfo(info, &generated_name);
|
| - if (info->save_as && !last_download_path_.empty())
|
| + if (info->prompt_user_for_save_location && !last_download_path_.empty())
|
| info->suggested_path = last_download_path_;
|
| else
|
| info->suggested_path = download_path();
|
| @@ -675,7 +676,8 @@ void DownloadManager::StartDownload(DownloadCreateInfo* info) {
|
| info->suggested_path = info->save_info.file_path;
|
| }
|
|
|
| - if (!info->save_as && info->save_info.file_path.empty()) {
|
| + if (!info->prompt_user_for_save_location &&
|
| + info->save_info.file_path.empty()) {
|
| // Downloads can be marked as dangerous for two reasons:
|
| // a) They have a dangerous-looking filename
|
| // b) They are an extension that is not from the gallery
|
| @@ -704,7 +706,7 @@ void DownloadManager::CheckIfSuggestedPathExists(DownloadCreateInfo* info) {
|
| FilePath dir = info->suggested_path.DirName();
|
| FilePath filename = info->suggested_path.BaseName();
|
| if (!file_util::PathIsWritable(dir)) {
|
| - info->save_as = true;
|
| + info->prompt_user_for_save_location = true;
|
| PathService::Get(chrome::DIR_USER_DOCUMENTS, &info->suggested_path);
|
| info->suggested_path = info->suggested_path.Append(filename);
|
| }
|
| @@ -741,11 +743,12 @@ void DownloadManager::CheckIfSuggestedPathExists(DownloadCreateInfo* info) {
|
| info->path_uniquifier = 0;
|
| } else if (info->path_uniquifier == -1) {
|
| // We failed to find a unique path. We have to prompt the user.
|
| - info->save_as = true;
|
| + info->prompt_user_for_save_location = true;
|
| }
|
| }
|
|
|
| - if (!info->save_as && info->save_info.file_path.empty()) {
|
| + if (!info->prompt_user_for_save_location &&
|
| + info->save_info.file_path.empty()) {
|
| // Create an empty file at the suggested path so that we don't allocate the
|
| // same "non-existant" path to multiple downloads.
|
| // See: http://code.google.com/p/chromium/issues/detail?id=3662
|
| @@ -764,7 +767,7 @@ void DownloadManager::OnPathExistenceAvailable(DownloadCreateInfo* info) {
|
| DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
|
| DCHECK(info);
|
|
|
| - if (info->save_as) {
|
| + if (info->prompt_user_for_save_location) {
|
| // We must ask the user for the place to put the download.
|
| if (!select_file_dialog_.get())
|
| select_file_dialog_ = SelectFileDialog::Create(this);
|
| @@ -811,7 +814,7 @@ void DownloadManager::ContinueStartDownload(DownloadCreateInfo* info,
|
| info->child_id,
|
| info->request_id,
|
| info->is_dangerous,
|
| - info->save_as,
|
| + info->prompt_user_for_save_location,
|
| profile_->IsOffTheRecord(),
|
| info->is_extension_install,
|
| !info->save_info.file_path.empty());
|
| @@ -1644,7 +1647,7 @@ void DownloadManager::SaveAutoOpens() {
|
| void DownloadManager::FileSelected(const FilePath& path,
|
| int index, void* params) {
|
| DownloadCreateInfo* info = reinterpret_cast<DownloadCreateInfo*>(params);
|
| - if (info->save_as)
|
| + if (info->prompt_user_for_save_location)
|
| last_download_path_ = path.DirName();
|
| ContinueStartDownload(info, path);
|
| }
|
|
|