diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-17 22:06:58 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-17 22:06:58 +0000 |
commit | e9ebf3fcc242c5686903956ae879cdf446325a24 (patch) | |
tree | 83684cc2aa2dfca62d2d5c3174ffa669928fbbff | |
parent | 30d172dec2aeb667710bda68498adb73f5d2ba9e (diff) | |
download | chromium_src-e9ebf3fcc242c5686903956ae879cdf446325a24.zip chromium_src-e9ebf3fcc242c5686903956ae879cdf446325a24.tar.gz chromium_src-e9ebf3fcc242c5686903956ae879cdf446325a24.tar.bz2 |
We were still warning about a dangerous download when the user has picked the option to always ask for download.
BUG=3539
TEST=Select the option "always ask for download". Download an exe. You should not see a dangerous download warning.
Review URL: http://codereview.chromium.org/7634
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3570 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/download/download_manager.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc index 766d214..f88bb80 100644 --- a/chrome/browser/download/download_manager.cc +++ b/chrome/browser/download/download_manager.cc @@ -526,6 +526,13 @@ void DownloadManager::StartDownload(DownloadCreateInfo* info) { info->suggested_path = *download_path_; file_util::AppendToPath(&info->suggested_path, generated_name); + // Let's check if this download is dangerous, based on its name. + if (!*prompt_for_download_ && !info->save_as) { + const std::wstring filename = + file_util::GetFilenameFromPath(info->suggested_path); + info->is_dangerous = IsDangerous(filename); + } + // We need to move over to the download thread because we don't want to stat // the suggested path on the UI thread. file_loop_->PostTask(FROM_HERE, @@ -551,7 +558,7 @@ void DownloadManager::CheckIfSuggestedPathExists(DownloadCreateInfo* info) { info->path_uniquifier = GetUniquePathNumber(info->suggested_path); // If the download is deemmed dangerous, we'll use a temporary name for it. - if (!info->save_as && IsDangerous(filename)) { + if (info->is_dangerous) { info->original_name = file_util::GetFilenameFromPath(info->suggested_path); // Create a temporary file to hold the file until the user approves its // download. @@ -566,7 +573,6 @@ void DownloadManager::CheckIfSuggestedPathExists(DownloadCreateInfo* info) { path.clear(); } info->suggested_path = path; - info->is_dangerous = true; } else { // We know the final path, build it if necessary. if (info->path_uniquifier > 0) { |