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

Unified Diff: chrome/browser/prefs/tracked/pref_service_hash_store_contents.cc

Issue 326403003: Remove all traces of pref hash stores after last store reset. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add test. Created 6 years, 6 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/prefs/tracked/pref_service_hash_store_contents_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/tracked/pref_service_hash_store_contents.cc
diff --git a/chrome/browser/prefs/tracked/pref_service_hash_store_contents.cc b/chrome/browser/prefs/tracked/pref_service_hash_store_contents.cc
index 103e3501af6b8ebd1cef9b5df02775de66667605..e121df367879be41fddc2c3ca17231a59e6f013c 100644
--- a/chrome/browser/prefs/tracked/pref_service_hash_store_contents.cc
+++ b/chrome/browser/prefs/tracked/pref_service_hash_store_contents.cc
@@ -85,15 +85,23 @@ void PrefServiceHashStoreContents::Reset() {
// Remove this store's entry in the kStoreVersionsDict.
base::DictionaryValue* version_dict;
- if (update->GetDictionary(kStoreVersionsDict, &version_dict))
+ if (update->GetDictionary(kStoreVersionsDict, &version_dict)) {
version_dict->RemoveWithoutPathExpansion(hash_store_id_, NULL);
+ if (version_dict->empty())
+ update->RemovePath(kStoreVersionsDict, NULL);
+ }
// Remove this store's entry in the kHashOfHashesDict.
base::DictionaryValue* hash_of_hashes_dict;
if (update->GetDictionaryWithoutPathExpansion(kHashOfHashesDict,
&hash_of_hashes_dict)) {
hash_of_hashes_dict->RemoveWithoutPathExpansion(hash_store_id_, NULL);
+ if (hash_of_hashes_dict->empty())
+ update->RemovePath(kHashOfHashesDict, NULL);
}
+
+ if (update->empty())
+ pref_service_->ClearPref(prefs::kProfilePreferenceHashes);
}
bool PrefServiceHashStoreContents::IsInitialized() const {
« no previous file with comments | « no previous file | chrome/browser/prefs/tracked/pref_service_hash_store_contents_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698