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 5482e3607bdba4da7291219a66c552d85ff8cb18..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 { |
@@ -103,21 +111,6 @@ bool PrefServiceHashStoreContents::IsInitialized() const { |
NULL); |
} |
-bool PrefServiceHashStoreContents::GetVersion(int* version) const { |
- DCHECK(version); |
- const base::DictionaryValue* pref_hash_data = |
- pref_service_->GetDictionary(prefs::kProfilePreferenceHashes); |
- |
- const base::DictionaryValue* version_dict; |
- return pref_hash_data->GetDictionary(kStoreVersionsDict, &version_dict) && |
- version_dict->GetIntegerWithoutPathExpansion(hash_store_id_, version); |
-} |
- |
-void PrefServiceHashStoreContents::SetVersion(int version) { |
- PrefServiceMutableDictionary(kStoreVersionsDict, pref_service_) |
- ->SetIntegerWithoutPathExpansion(hash_store_id_, version); |
-} |
- |
const base::DictionaryValue* PrefServiceHashStoreContents::GetContents() const { |
const base::DictionaryValue* pref_hash_dicts = |
pref_service_->GetDictionary(prefs::kProfilePreferenceHashes); |