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

Unified Diff: chrome/browser/download/download_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: Correct typo Created 9 years, 7 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_manager.cc
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc
index 58090f2d492e18f00c5dc16dca08589f9e43e6e1..a778f1481bcd8766625a83351687a05dcca16420 100644
--- a/chrome/browser/download/download_manager.cc
+++ b/chrome/browser/download/download_manager.cc
@@ -368,19 +368,14 @@ void DownloadManager::CheckIfSuggestedPathExists(int32 download_id,
const FilePath& default_path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- // Make sure the default download directory exists.
- // TODO(phajdan.jr): only create the directory when we're sure the user
- // is going to save there and not to another directory of his choice.
- file_util::CreateDirectory(default_path);
-
// Check writability of the suggested path. If we can't write to it, default
- // to the user's "My Documents" directory. We'll prompt them in this case.
+ // to the user's "Downloads" directory. We'll prompt them in this case.
FilePath dir = state.suggested_path.DirName();
FilePath filename = state.suggested_path.BaseName();
if (!file_util::PathIsWritable(dir)) {
VLOG(1) << "Unable to write to directory \"" << dir.value() << "\"";
state.prompt_user_for_save_location = true;
- PathService::Get(chrome::DIR_USER_DOCUMENTS, &state.suggested_path);
+ PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &state.suggested_path);
Paweł Hajdan Jr. 2011/05/31 17:15:53 Oh, this code didn't check return value of PathSer
haraken1 2011/06/02 09:13:22 Done.
state.suggested_path = state.suggested_path.Append(filename);
}
@@ -495,7 +490,7 @@ void DownloadManager::OnPathExistenceAvailable(int32 download_id,
contents, owning_window,
reinterpret_cast<void*>(id_ptr));
FOR_EACH_OBSERVER(Observer, observers_,
- SelectFileDialogDisplayed(download_id));
+ SelectFileDialogDisplayed(download_id, suggested_path));
} else {
// No prompting for download, just continue with the suggested name.
ContinueDownloadWithPath(download, suggested_path);

Powered by Google App Engine
This is Rietveld 408576698