Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5115)

Unified Diff: chrome/browser/download/base_file.cc

Issue 6973052: When the download folder does not exist, change the download folder to a user's "Downloads" (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Overrides the user's "Downloads" folder in DownloadPrefs Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/download/base_file.cc
diff --git a/chrome/browser/download/base_file.cc b/chrome/browser/download/base_file.cc
index 7ea96b5d758c662fd3515ec0daa96a84b3c3a661..8c442865c60edadb3a5b293982df5f899c511efc 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,11 @@ 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()) {
+ if (!file_util::CreateTemporaryFileInDir(save_path, &full_path_))
Paweł Hajdan Jr. 2011/06/15 09:31:33 nit: Instead of having a nested "if", how about ad
haraken1 2011/06/15 10:39:45 Done.
+ return false;
+ }
+ return Open();
}
bool BaseFile::AppendDataToFile(const char* data, size_t data_len) {

Powered by Google App Engine
This is Rietveld 408576698