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

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

Issue 7013046: Implemented a policy for centralized setting of the --disk-cache-dir flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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
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 96dfb2eec67b6087cb60694e2dac4ec0f381c36a..7edb5436876bcc8741ff473ac6868aeed07cf3e6 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) {
@@ -1001,6 +1029,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,

Powered by Google App Engine
This is Rietveld 408576698