diff options
author | jungshik@google.com <jungshik@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-28 00:44:12 +0000 |
---|---|---|
committer | jungshik@google.com <jungshik@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-28 00:44:12 +0000 |
commit | cbc43fc87b9db405002eef9c769b39a192c4147c (patch) | |
tree | 8ace41a10ee5cff16b11443ea00ded9b23f61394 /chrome | |
parent | 6de892232d348bc86167e0b9a984d0ffa3b4c5b6 (diff) | |
download | chromium_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')
-rw-r--r-- | chrome/app/generated_resources.grd | 6 | ||||
-rw-r--r-- | chrome/browser/download/download_manager.cc | 5 | ||||
-rw-r--r-- | chrome/browser/download/save_package.cc | 6 | ||||
-rw-r--r-- | chrome/common/chrome_paths.cc | 14 | ||||
-rw-r--r-- | chrome/common/chrome_paths.h | 1 |
5 files changed, 20 insertions, 12 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 2a14116..3bafa68 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -1228,12 +1228,6 @@ each locale. --> &Remove </message> - <!-- Download Preferences --> - <message name="IDS_DOWNLOAD_DIRECTORY" - desc="Directory under the profile for storing downloads"> - Downloads - </message> - <!-- Gears shortcut strings --> <message name="IDS_DEFAULT_INSTALL_SITE_LABEL" desc="Default installation menu label"> Create application &shortcuts... diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc index 23af781..402fab1 100644 --- a/chrome/browser/download/download_manager.cc +++ b/chrome/browser/download/download_manager.cc @@ -294,11 +294,10 @@ void DownloadManager::RegisterUserPrefs(PrefService* prefs) { // The default download path is userprofile\download. std::wstring default_download_path; - if (!PathService::Get(chrome::DIR_USER_DOCUMENTS, &default_download_path)) { + if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, + &default_download_path)) { NOTREACHED(); } - file_util::AppendToPath(&default_download_path, - l10n_util::GetString(IDS_DOWNLOAD_DIRECTORY)); prefs->RegisterStringPref(prefs::kDownloadDefaultDirectory, default_download_path); diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc index b8bfc12..3e206c8 100644 --- a/chrome/browser/download/save_package.cc +++ b/chrome/browser/download/save_package.cc @@ -889,9 +889,9 @@ std::wstring SavePackage::GetSuggestNameForSaveAs(PrefService* prefs, // If not, initialize it with default directory. if (!prefs->IsPrefRegistered(prefs::kSaveFileDefaultDirectory)) { std::wstring default_save_path; - PathService::Get(chrome::DIR_USER_DOCUMENTS, &default_save_path); - file_util::AppendToPath(&default_save_path, - l10n_util::GetString(IDS_DOWNLOAD_DIRECTORY)); + if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, + &default_save_path)) + NOTREACHED(); prefs->RegisterStringPref(prefs::kSaveFileDefaultDirectory, default_save_path); } 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.) |