Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2423)

Unified Diff: chrome/browser/policy/configuration_policy_pref_store.cc

Issue 7583005: When the download policy is specified but left empty revert to default download location. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/configuration_policy_pref_store.cc
diff --git a/chrome/browser/policy/configuration_policy_pref_store.cc b/chrome/browser/policy/configuration_policy_pref_store.cc
index 99a15aeadfacf6ff84d8462a7e56f8bea89f77da..ff5c1b1edeb51e979f6e0104fc92e374dc9cbb02 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"
@@ -477,6 +478,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,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698