diff options
author | danno@chromium.org <danno@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-16 09:33:45 +0000 |
---|---|---|
committer | danno@chromium.org <danno@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-16 09:33:45 +0000 |
commit | 387a6ceae16e24b7ed19dc143f97c3378ca343df (patch) | |
tree | 569e50058826292cd941fe4fa0745386d9a73b22 /chrome/browser | |
parent | 9a93504fcb4975e7685ef638b726902db8e4f3e9 (diff) | |
download | chromium_src-387a6ceae16e24b7ed19dc143f97c3378ca343df.zip chromium_src-387a6ceae16e24b7ed19dc143f97c3378ca343df.tar.gz chromium_src-387a6ceae16e24b7ed19dc143f97c3378ca343df.tar.bz2 |
Implements policy to enable or disable the password manager, as found in the Options dialog, in the Under the Personal Stuff section.
xib changes: added an enabled binding to the policy-controlled checkboxes in the "Personal Stuff" preference pane so that they can be disabled when their value is overridden by policy. The methods for the bindings are in the preference window controller.
BUG=44395
TEST=ConfigurationPolicyPrefStoreTest.* and ConfigurationPolicyProviderWinTest.* Manual tests: Set the policy externally. Check that the radio buttons and the "Show saved passwords" button in Options/Personal Stuff/Passwords are disabled. Also check that the check box is set/unset as done by the policy.
Review URL: http://codereview.chromium.org/2848039
Patch from Jean-Luc Brouillet <jeanluc@google.com>.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52637 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
8 files changed, 35 insertions, 1 deletions
diff --git a/chrome/browser/cocoa/preferences_window_controller.mm b/chrome/browser/cocoa/preferences_window_controller.mm index a9c2cf3..b680c83 100644 --- a/chrome/browser/cocoa/preferences_window_controller.mm +++ b/chrome/browser/cocoa/preferences_window_controller.mm @@ -1280,6 +1280,11 @@ const int kDisabledIndex = 1; return askSavePasswords_.GetValue() ? kEnabledIndex : kDisabledIndex; } +// Returns whether the password manager buttons should be enabled. +- (BOOL)isPasswordManagerEnabled { + return !askSavePasswords_.IsManaged(); +} + - (void)setIsUsingDefaultTheme:(BOOL)value { if (value) [self recordUserAction:UserMetricsAction( diff --git a/chrome/browser/configuration_policy_pref_store.cc b/chrome/browser/configuration_policy_pref_store.cc index 2479a67..705aaf6 100644 --- a/chrome/browser/configuration_policy_pref_store.cc +++ b/chrome/browser/configuration_policy_pref_store.cc @@ -26,6 +26,8 @@ const ConfigurationPolicyPrefStore::PolicyToPreferenceMapEntry prefs::kDnsPrefetchingEnabled }, { Value::TYPE_BOOLEAN, kPolicySafeBrowsingEnabled, prefs::kSafeBrowsingEnabled }, + { Value::TYPE_BOOLEAN, kPolicyPasswordManagerEnabled, + prefs::kPasswordManagerEnabled }, { Value::TYPE_BOOLEAN, kPolicyMetricsReportingEnabled, prefs::kMetricsReportingEnabled }, }; diff --git a/chrome/browser/configuration_policy_pref_store_unittest.cc b/chrome/browser/configuration_policy_pref_store_unittest.cc index 56dc576..0e74c94 100644 --- a/chrome/browser/configuration_policy_pref_store_unittest.cc +++ b/chrome/browser/configuration_policy_pref_store_unittest.cc @@ -171,6 +171,11 @@ TEST_F(ConfigurationPolicyPrefStoreTest, TestPolicyMetricsReportingEnabled) { ConfigurationPolicyStore::kPolicyMetricsReportingEnabled); } +TEST_F(ConfigurationPolicyPrefStoreTest, TestPolicyPasswordManagerEnabled) { + TestBooleanPolicy(prefs::kPasswordManagerEnabled, + ConfigurationPolicyStore::kPolicyPasswordManagerEnabled); +} + TEST_F(ConfigurationPolicyPrefStoreTest, TestSettingProxyServer) { TestStringPolicy(prefs::kProxyServer, ConfigurationPolicyPrefStore::kPolicyProxyServer); diff --git a/chrome/browser/configuration_policy_provider.cc b/chrome/browser/configuration_policy_provider.cc index 4cdc433..8b28c04 100644 --- a/chrome/browser/configuration_policy_provider.cc +++ b/chrome/browser/configuration_policy_provider.cc @@ -40,10 +40,12 @@ const InternalPolicyValueMapEntry kPolicyValueMap[] = { Value::TYPE_BOOLEAN, "SafeBrowsingEnabled" }, { ConfigurationPolicyStore::kPolicyMetricsReportingEnabled, Value::TYPE_BOOLEAN, "MetricsReportingEnabled" }, + { ConfigurationPolicyStore::kPolicyPasswordManagerEnabled, + Value::TYPE_BOOLEAN, "PasswordManagerEnabled" }, { ConfigurationPolicyStore::kPolicyDisabledPlugins, Value::TYPE_STRING, "DisabledPluginsList" }, { ConfigurationPolicyStore::kPolicySyncDisabled, - Value::TYPE_BOOLEAN, "SyncDisabled" } + Value::TYPE_BOOLEAN, "SyncDisabled" }, }; } // namespace diff --git a/chrome/browser/configuration_policy_provider_win_unittest.cc b/chrome/browser/configuration_policy_provider_win_unittest.cc index cefe646..6197780 100644 --- a/chrome/browser/configuration_policy_provider_win_unittest.cc +++ b/chrome/browser/configuration_policy_provider_win_unittest.cc @@ -308,3 +308,8 @@ TEST_F(ConfigurationPolicyProviderWinTest, TestBooleanPolicy(ConfigurationPolicyStore::kPolicyMetricsReportingEnabled); } +TEST_F(ConfigurationPolicyProviderWinTest, + TestPolicyPasswordManagerEnabled) { + TestBooleanPolicy(ConfigurationPolicyStore::kPolicyPasswordManagerEnabled); +} + diff --git a/chrome/browser/configuration_policy_store.h b/chrome/browser/configuration_policy_store.h index b12e2a5..55d7eb85 100644 --- a/chrome/browser/configuration_policy_store.h +++ b/chrome/browser/configuration_policy_store.h @@ -26,6 +26,7 @@ class ConfigurationPolicyStore { kPolicyDnsPrefetchingEnabled, kPolicySafeBrowsingEnabled, kPolicyMetricsReportingEnabled, + kPolicyPasswordManagerEnabled, kPolicySyncDisabled, // A policy for allowing administrators to forcibly disable diff --git a/chrome/browser/gtk/options/content_page_gtk.cc b/chrome/browser/gtk/options/content_page_gtk.cc index ef3b1a2..fa34529 100644 --- a/chrome/browser/gtk/options/content_page_gtk.cc +++ b/chrome/browser/gtk/options/content_page_gtk.cc @@ -232,6 +232,14 @@ GtkWidget* ContentPageGtk::InitPasswordSavingGroup() { gtk_box_pack_start(GTK_BOX(button_hbox), show_passwords_button, FALSE, FALSE, 0); + bool isPasswordManagerEnabled = !ask_to_save_passwords_.IsManaged(); + gtk_widget_set_sensitive(passwords_asktosave_radio_, + isPasswordManagerEnabled); + gtk_widget_set_sensitive(passwords_neversave_radio_, + isPasswordManagerEnabled); + gtk_widget_set_sensitive(show_passwords_button, + isPasswordManagerEnabled); + return vbox; } diff --git a/chrome/browser/views/options/content_page_view.cc b/chrome/browser/views/options/content_page_view.cc index 1a368e7..bedbb0e 100644 --- a/chrome/browser/views/options/content_page_view.cc +++ b/chrome/browser/views/options/content_page_view.cc @@ -236,6 +236,12 @@ void ContentPageView::InitControlLayout() { profile()->GetPrefs(), this); is_using_default_theme_.Init(prefs::kCurrentThemeID, profile()->GetPrefs(), this); + + // Disable UI elements that are managed via policy. + bool enablePasswordManagerElements = !ask_to_save_passwords_.IsManaged(); + passwords_asktosave_radio_->SetEnabled(enablePasswordManagerElements); + passwords_neversave_radio_->SetEnabled(enablePasswordManagerElements); + show_passwords_button_->SetEnabled(enablePasswordManagerElements); } void ContentPageView::NotifyPrefChanged(const std::wstring* pref_name) { |