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

Unified Diff: chrome/browser/download/download_file_manager.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/download_file_manager.cc
diff --git a/chrome/browser/download/download_file_manager.cc b/chrome/browser/download/download_file_manager.cc
index 16a0ac7654cae56b255f287419e9a943f59f48ef..5e1ae3decff9e24c343f6da4dc45e6be08886015 100644
--- a/chrome/browser/download/download_file_manager.cc
+++ b/chrome/browser/download/download_file_manager.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/download/download_create_info.h"
#include "chrome/browser/download/download_manager.h"
+#include "chrome/browser/download/download_prefs.h"
#include "chrome/browser/download/download_request_handle.h"
#include "chrome/browser/download/download_util.h"
#include "chrome/browser/net/chrome_url_request_context.h"
@@ -56,9 +57,9 @@ void DownloadFileManager::OnShutdown() {
STLDeleteValues(&downloads_);
}
-void DownloadFileManager::CreateDownloadFile(DownloadCreateInfo* info,
- DownloadManager* download_manager,
- bool get_hash) {
+void DownloadFileManager::CreateDownloadFile(
+ DownloadCreateInfo* info, DownloadManager* download_manager,
+ bool get_hash, const FilePath& default_download_dir) {
DCHECK(info);
VLOG(20) << __FUNCTION__ << "()" << " info = " << info->DebugString();
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
@@ -68,7 +69,7 @@ void DownloadFileManager::CreateDownloadFile(DownloadCreateInfo* info,
scoped_ptr<DownloadFile>
download_file(new DownloadFile(info, download_manager));
- if (!download_file->Initialize(get_hash)) {
+ if (!download_file->Initialize(get_hash, default_download_dir)) {
info->request_handle.CancelRequest();
return;
}
@@ -146,10 +147,13 @@ void DownloadFileManager::StartDownload(DownloadCreateInfo* info) {
bool hash_needed = g_browser_process->safe_browsing_service()->
DownloadBinHashNeeded();
+ FilePath default_download_dir =
+ manager->download_prefs()->GetDefaultDownloadDirectory();
BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
NewRunnableMethod(this, &DownloadFileManager::CreateDownloadFile,
- info, make_scoped_refptr(manager), hash_needed));
+ info, make_scoped_refptr(manager),
+ hash_needed, default_download_dir));
}
// We don't forward an update to the UI thread here, since we want to throttle
@@ -274,7 +278,7 @@ void DownloadFileManager::OnDownloadManagerShutdown(DownloadManager* manager) {
//
// There are 2 possible rename cases where this method can be called:
// 1. tmp -> foo.crdownload (not final, safe)
-// 2. tmp-> Unconfirmed.xxx.crdownload (not final, dangerous)
+// 2. tmp -> Unconfirmed.xxx.crdownload (not final, dangerous)
void DownloadFileManager::RenameInProgressDownloadFile(
int id, const FilePath& full_path) {
VLOG(20) << __FUNCTION__ << "()" << " id = " << id

Powered by Google App Engine
This is Rietveld 408576698