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 822021a6626d4c2af8de7f09def1ac053e0b6b89..33c5a9d4ef529cff2a90b7c4760ebeeb2a35b8a8 100644 |
--- a/chrome/browser/policy/configuration_policy_pref_store.cc |
+++ b/chrome/browser/policy/configuration_policy_pref_store.cc |
@@ -92,6 +92,11 @@ class ConfigurationPolicyPrefKeeper |
// ownership of |value| in the case that the policy is recognized. |
bool ApplyDownloadDirPolicy(ConfigurationPolicyType policy, Value* value); |
+ // Processes disk cache directory policy. Returns true if the specified policy |
+ // is the right one. ApplyDiskCacheDirPolicy assumes the |
+ // ownership of |value| in the case that the policy is recognized. |
+ bool ApplyDiskCacheDirPolicy(ConfigurationPolicyType policy, Value* value); |
+ |
// Processes file-selection dialogs policy. Returns true if the specified |
// policy is the file-selection dialogs policy. |
// ApplyFileSelectionDialogsPolicy assumes the ownership of |value| in the |
@@ -336,6 +341,9 @@ void ConfigurationPolicyPrefKeeper::Apply(ConfigurationPolicyType policy, |
if (ApplyDownloadDirPolicy(policy, value)) |
return; |
+ if (ApplyDiskCacheDirPolicy(policy, value)) |
+ return; |
+ |
if (ApplyFileSelectionDialogsPolicy(policy, value)) |
return; |
@@ -447,6 +455,26 @@ bool ConfigurationPolicyPrefKeeper::ApplyDownloadDirPolicy( |
return false; |
} |
+bool ConfigurationPolicyPrefKeeper::ApplyDiskCacheDirPolicy( |
+ ConfigurationPolicyType policy, |
+ Value* value) { |
+ // Replace the policy string which might contain some user variables to an |
+ // expanded string. |
+ if (policy == kPolicyDiskCacheDir) { |
+ FilePath::StringType string_value; |
+ bool result = value->GetAsString(&string_value); |
+ DCHECK(result); |
+ FilePath::StringType expanded_value = |
+ policy::path_parser::ExpandPathVariables(string_value); |
+ prefs_.SetValue(prefs::kDiskCacheDir, |
+ Value::CreateStringValue(expanded_value)); |
+ delete value; |
+ return true; |
+ } |
+ // We are not interested in this policy. |
+ return false; |
+} |
+ |
bool ConfigurationPolicyPrefKeeper::ApplyFileSelectionDialogsPolicy( |
ConfigurationPolicyType policy, |
Value* value) { |
@@ -1011,6 +1039,8 @@ ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList() { |
key::kEditBookmarksEnabled }, |
{ kPolicyAllowFileSelectionDialogs, Value::TYPE_BOOLEAN, |
key::kAllowFileSelectionDialogs }, |
+ { kPolicyDiskCacheDir, Value::TYPE_STRING, |
+ key::kDiskCacheDir }, |
#if defined(OS_CHROMEOS) |
{ kPolicyChromeOsLockOnIdleSuspend, Value::TYPE_BOOLEAN, |