summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorpastarmovj@chromium.org <pastarmovj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-27 13:06:47 +0000
committerpastarmovj@chromium.org <pastarmovj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-27 13:06:47 +0000
commitccd4dccbf2bd166f89e98b89ec365d9aa60fb48e (patch)
tree5e60c78d643c886510b7a5dab28b41abe505a47f /chrome
parente67ce755d9c314743abf9a2227a868282b1bd1a9 (diff)
downloadchromium_src-ccd4dccbf2bd166f89e98b89ec365d9aa60fb48e.zip
chromium_src-ccd4dccbf2bd166f89e98b89ec365d9aa60fb48e.tar.gz
chromium_src-ccd4dccbf2bd166f89e98b89ec365d9aa60fb48e.tar.bz2
Simplified PrefValueStore::NotifyPrefChanged.
Reason for the refactoring is the need to properly handle disappearing policies. This situation arises when a managed preference is removed that only has been registered in one pref store (for example local_store) the notification is sent to all pref stores though but the profile pref store doesn't have a default value for that pref and therefore ControllingPrefStoreForPref returns INVALID_STORE which shouldn't be treated as an exceptional situation (DCHECKed). BUG=71028 TEST=unit_tests --gtest_filter=*Pref* should give pretty good coverage. Review URL: http://codereview.chromium.org/6357019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72787 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/prefs/pref_value_store.cc19
1 files changed, 4 insertions, 15 deletions
diff --git a/chrome/browser/prefs/pref_value_store.cc b/chrome/browser/prefs/pref_value_store.cc
index c86accd..c16491e 100644
--- a/chrome/browser/prefs/pref_value_store.cc
+++ b/chrome/browser/prefs/pref_value_store.cc
@@ -117,21 +117,10 @@ void PrefValueStore::NotifyPrefChanged(
PrefValueStore::PrefStoreType new_store) {
DCHECK(new_store != INVALID_STORE);
- bool changed = true;
- // Replying that the pref has changed in case the new store is invalid may
- // cause problems, but it's the safer choice.
- if (new_store != INVALID_STORE) {
- PrefStoreType controller = ControllingPrefStoreForPref(path);
- DCHECK(controller != INVALID_STORE);
- // If the pref is controlled by a higher-priority store, its effective value
- // cannot have changed.
- if (controller != INVALID_STORE &&
- controller < new_store) {
- changed = false;
- }
- }
-
- if (changed)
+ // If the pref is controlled by a higher-priority store, its effective value
+ // cannot have changed.
+ PrefStoreType controller = ControllingPrefStoreForPref(path);
+ if (controller == INVALID_STORE || controller >= new_store)
pref_notifier_->OnPreferenceChanged(path);
}