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 3f74a0137462f5aa2b69d064884410bdb46f64ba..27eac7d5ea0d6e9601931ef961aaa4c07fefeb47 100644 |
--- a/chrome/browser/policy/configuration_policy_pref_store.cc |
+++ b/chrome/browser/policy/configuration_policy_pref_store.cc |
@@ -106,6 +106,10 @@ class ConfigurationPolicyPrefKeeper |
// ApplyDefaultSearchPolicy takes ownership of |value|. |
bool ApplyDefaultSearchPolicy(ConfigurationPolicyType policy, Value* value); |
+ // Processes a policy that can disable the bookmarks bar. It can also affect |
+ // other preferences. |
+ bool ApplyBookmarksPolicy(ConfigurationPolicyType policy, Value* value); |
+ |
// Make sure that the |path| if present in |prefs_|. If not, set it to |
// a blank string. |
void EnsureStringPrefExists(const std::string& path); |
@@ -271,15 +275,12 @@ const ConfigurationPolicyPrefKeeper::PolicyToPreferenceMapEntry |
{ Value::TYPE_BOOLEAN, kPolicyCloudPrintProxyEnabled, |
prefs::kCloudPrintProxyEnabled }, |
{ Value::TYPE_BOOLEAN, kPolicyTranslateEnabled, prefs::kEnableTranslate }, |
- { Value::TYPE_BOOLEAN, kPolicyBookmarkBarEnabled, prefs::kEnableBookmarkBar }, |
{ Value::TYPE_BOOLEAN, kPolicyAllowOutdatedPlugins, |
prefs::kPluginsAllowOutdated }, |
{ Value::TYPE_BOOLEAN, kPolicyAlwaysAuthorizePlugins, |
prefs::kPluginsAlwaysAuthorize }, |
{ Value::TYPE_BOOLEAN, kPolicyEditBookmarksEnabled, |
prefs::kEditBookmarksEnabled }, |
- { Value::TYPE_BOOLEAN, kPolicyAllowFileSelectionDialogs, |
- prefs::kAllowFileSelectionDialogs }, |
{ Value::TYPE_INTEGER, kPolicyMaxConnectionsPerProxy, |
prefs::kMaxConnectionsPerProxy }, |
@@ -369,6 +370,9 @@ void ConfigurationPolicyPrefKeeper::Apply(ConfigurationPolicyType policy, |
if (ApplyDefaultSearchPolicy(policy, value)) |
return; |
+ if (ApplyBookmarksPolicy(policy, value)) |
Peter Kasting
2011/08/04 18:44:43
Nit: Shorter would be
if (ApplyXYZPolicy(policy,
Joao da Silva
2011/08/05 09:24:11
Done.
|
+ return; |
+ |
if (ApplyPolicyFromMap(policy, value, kSimplePolicyMap, |
arraysize(kSimplePolicyMap))) |
return; |
@@ -556,6 +560,21 @@ bool ConfigurationPolicyPrefKeeper::ApplyDefaultSearchPolicy( |
return false; |
} |
+bool ConfigurationPolicyPrefKeeper::ApplyBookmarksPolicy( |
+ ConfigurationPolicyType policy, |
+ Value* value) { |
+ if (policy != kPolicyBookmarkBarEnabled) |
+ return false; |
+ DCHECK_EQ(Value::TYPE_BOOLEAN, value->GetType()); |
+ prefs_.SetValue(prefs::kEnableBookmarkBar, value); |
+ // kShowBookmarkBar is not managed directly by a policy, but when |
+ // kEnableBookmarkBar is managed, kShowBookmarkBar should be false so that |
+ // the bookmarks bar either is completely disabled or only shows on the NTP. |
Peter Kasting
2011/08/04 18:44:43
There's no policy configuration that corresponds t
Joao da Silva
2011/08/05 09:24:11
The "always show the bookmarks bar" preference jus
|
+ // This also disables the checkbox for this preference in the prefs UI. |
+ prefs_.SetValue(prefs::kShowBookmarkBar, Value::CreateBooleanValue(false)); |
+ return true; |
+} |
+ |
void ConfigurationPolicyPrefKeeper::EnsureStringPrefExists( |
const std::string& path) { |
std::string value; |