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

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

Issue 7564011: Prevent accelerators from toggling the bookmark bar when disabled by policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased 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 | chrome/browser/ui/browser.h » ('j') | 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 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;
« no previous file with comments | « no previous file | chrome/browser/ui/browser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698