From cbc43fc87b9db405002eef9c769b39a192c4147c Mon Sep 17 00:00:00 2001 From: "jungshik@google.com" Date: Tue, 28 Oct 2008 00:44:12 +0000 Subject: 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 --- chrome/common/chrome_paths.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'chrome/common/chrome_paths.cc') 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 -- cgit v1.1