summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/chrome_paths.cc14
-rw-r--r--chrome/common/chrome_paths.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc
index 9d6da38..6a42dea 100644
--- a/chrome/common/chrome_paths.cc
+++ b/chrome/common/chrome_paths.cc
@@ -86,6 +86,20 @@ bool PathProvider(int key, std::wstring* result) {
if (!GetUserDirectory(CSIDL_MYDOCUMENTS, &cur))
return false;
break;
+ case chrome::DIR_DEFAULT_DOWNLOADS:
+ // On Vista, we can get the download path using a Win API
+ // (http://msdn.microsoft.com/en-us/library/bb762584(VS.85).aspx),
+ // but it can be set to Desktop, which is dangerous. Instead,
+ // we just use 'Downloads' under DIR_USER_DOCUMENTS. Localizing
+ // 'downloads' is not a good idea because Chrome's UI language
+ // can be changed.
+ if (!PathService::Get(chrome::DIR_USER_DOCUMENTS, &cur))
+ return false;
+ file_util::AppendToPath(&cur, L"Downloads");
+ // TODO(port): This will fail on other platforms unless we
+ // implement DIR_USER_DOCUMENTS or use xdg-user-dirs to
+ // get the download directory independently of DIR_USER_DOCUMENTS.
+ break;
case chrome::DIR_CRASH_DUMPS:
// The crash reports are always stored relative to the default user data
// directory. This avoids the problem of having to re-initialize the
diff --git a/chrome/common/chrome_paths.h b/chrome/common/chrome_paths.h
index 8128122..17c1cd9 100644
--- a/chrome/common/chrome_paths.h
+++ b/chrome/common/chrome_paths.h
@@ -24,6 +24,7 @@ enum {
DIR_LOCALES, // directory where locale resources are stored
DIR_APP_DICTIONARIES, // directory where the global dictionaries are
DIR_USER_DOCUMENTS, // directory for a user's "My Documents"
+ DIR_DEFAULT_DOWNLOADS, // directory for a user's "My Documents/Downloads"
DIR_USER_SCRIPTS, // directory where Greasemonkey user scripts are stored
FILE_RESOURCE_MODULE, // full path and filename of the module that contains
// embedded resources (version, strings, images, etc.)