summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authorjungshik@google.com <jungshik@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-28 00:44:12 +0000
committerjungshik@google.com <jungshik@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-28 00:44:12 +0000
commitcbc43fc87b9db405002eef9c769b39a192c4147c (patch)
tree8ace41a10ee5cff16b11443ea00ded9b23f61394 /chrome/common
parent6de892232d348bc86167e0b9a984d0ffa3b4c5b6 (diff)
downloadchromium_src-cbc43fc87b9db405002eef9c769b39a192c4147c.zip
chromium_src-cbc43fc87b9db405002eef9c769b39a192c4147c.tar.gz
chromium_src-cbc43fc87b9db405002eef9c769b39a192c4147c.tar.bz2
Do not localize the name of 'download' directory. Chrome's UI languages can be
changed and a user will be confused as to where her download goes. Add DIR_DEFAULT_DOWNLOADS to chrome_paths (which is set to 'Downloads' under DIR_USER_DOCUMENTS) and use that in both save_package and download_manager. This patch does not offer a migration path. BUG=3097 TEST=Switch Chrome's UI to non-English and download a file. The file should be downloaded to '..\My Documents\Downloads' rather than '..\My Documents\<'Downloads' in that language>. Review URL: http://codereview.chromium.org/7945 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4049 0039d316-1c4b-4281-b951-d872f2087c98
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.)