Index: chrome/browser/download/base_file.cc |
diff --git a/chrome/browser/download/base_file.cc b/chrome/browser/download/base_file.cc |
index e52f08ad5b0a53e8de5e2d41c4abe00956ca853c..ea0ccf941110be7cb56bd0b6785fa496b3964445 100644 |
--- a/chrome/browser/download/base_file.cc |
+++ b/chrome/browser/download/base_file.cc |
@@ -46,7 +46,7 @@ BaseFile::~BaseFile() { |
Cancel(); // Will delete the file. |
} |
-bool BaseFile::Initialize(bool calculate_hash) { |
+bool BaseFile::Initialize(bool calculate_hash, const FilePath& save_path) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
DCHECK(!detached_); |
@@ -55,10 +55,10 @@ bool BaseFile::Initialize(bool calculate_hash) { |
if (calculate_hash_) |
secure_hash_.reset(crypto::SecureHash::Create(crypto::SecureHash::SHA256)); |
- if (!full_path_.empty() || |
- download_util::CreateTemporaryFileForDownload(&full_path_)) |
- return Open(); |
- return false; |
+ if (full_path_.empty() && |
+ !file_util::CreateTemporaryFileInDir(save_path, &full_path_)) |
+ return false; |
+ return Open(); |
} |
bool BaseFile::AppendDataToFile(const char* data, size_t data_len) { |