diff options
author | pastarmovj@chromium.org <pastarmovj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-26 09:39:28 +0000 |
---|---|---|
committer | pastarmovj@chromium.org <pastarmovj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-26 09:39:28 +0000 |
commit | 2cead601ebb28e98585f0f4fcbd1a2acff6139a3 (patch) | |
tree | 23b3983cd95fc6bff6ed79a719cad430d82f008d | |
parent | cb289d04ac4059e47d688d73b4773d43d3752aa9 (diff) | |
download | chromium_src-2cead601ebb28e98585f0f4fcbd1a2acff6139a3.zip chromium_src-2cead601ebb28e98585f0f4fcbd1a2acff6139a3.tar.gz chromium_src-2cead601ebb28e98585f0f4fcbd1a2acff6139a3.tar.bz2 |
When the download policy is specified but left empty revert to default download location.
If this is not done downloads go to crazy places like the chrome install
dir or god knows where else.
BUG=90722
TEST=Set the policy to empty string and observe downloads going to the default location instead.
Review URL: http://codereview.chromium.org/7583005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98411 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/policy/configuration_policy_pref_store.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/chrome/browser/policy/configuration_policy_pref_store.cc b/chrome/browser/policy/configuration_policy_pref_store.cc index 9bf4451..13cc468 100644 --- a/chrome/browser/policy/configuration_policy_pref_store.cc +++ b/chrome/browser/policy/configuration_policy_pref_store.cc @@ -18,6 +18,7 @@ #include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/download/download_util.h" #include "chrome/browser/policy/browser_policy_connector.h" #include "chrome/browser/policy/configuration_policy_provider.h" #include "chrome/browser/policy/policy_path_parser.h" @@ -481,6 +482,11 @@ bool ConfigurationPolicyPrefKeeper::ApplyDownloadDirPolicy( DCHECK(result); FilePath::StringType expanded_value = policy::path_parser::ExpandPathVariables(string_value); + // Leaving the policy empty would revert to the default download location + // else we would point in an undefined location. We do this after the + // path expansion because it might lead to an empty string(e.g. for "\"\""). + if (expanded_value.empty()) + expanded_value = download_util::GetDefaultDownloadDirectory().value(); prefs_.SetValue(prefs::kDownloadDefaultDirectory, Value::CreateStringValue(expanded_value)); prefs_.SetValue(prefs::kPromptForDownload, |