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

Side by Side Diff: chrome/browser/prefs/tracked/pref_service_hash_store_contents.cc

Issue 329093003: Remove unloaded profile hash store initialization, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove more code. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/prefs/tracked/pref_service_hash_store_contents.h" 5 #include "chrome/browser/prefs/tracked/pref_service_hash_store_contents.h"
6 6
7 #include "base/prefs/pref_registry_simple.h" 7 #include "base/prefs/pref_registry_simple.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/prefs/scoped_user_pref_update.h" 9 #include "base/prefs/scoped_user_pref_update.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 return hash_store_id_; 78 return hash_store_id_;
79 } 79 }
80 80
81 void PrefServiceHashStoreContents::Reset() { 81 void PrefServiceHashStoreContents::Reset() {
82 DictionaryPrefUpdate update(pref_service_, prefs::kProfilePreferenceHashes); 82 DictionaryPrefUpdate update(pref_service_, prefs::kProfilePreferenceHashes);
83 83
84 update->RemoveWithoutPathExpansion(hash_store_id_, NULL); 84 update->RemoveWithoutPathExpansion(hash_store_id_, NULL);
85 85
86 // Remove this store's entry in the kStoreVersionsDict. 86 // Remove this store's entry in the kStoreVersionsDict.
87 base::DictionaryValue* version_dict; 87 base::DictionaryValue* version_dict;
88 if (update->GetDictionary(kStoreVersionsDict, &version_dict)) 88 if (update->GetDictionary(kStoreVersionsDict, &version_dict))
gab 2014/06/11 19:25:42 Remove this code and instead unconditionally clear
89 version_dict->RemoveWithoutPathExpansion(hash_store_id_, NULL); 89 version_dict->RemoveWithoutPathExpansion(hash_store_id_, NULL);
90 90
91 // Remove this store's entry in the kHashOfHashesDict. 91 // Remove this store's entry in the kHashOfHashesDict.
92 base::DictionaryValue* hash_of_hashes_dict; 92 base::DictionaryValue* hash_of_hashes_dict;
93 if (update->GetDictionaryWithoutPathExpansion(kHashOfHashesDict, 93 if (update->GetDictionaryWithoutPathExpansion(kHashOfHashesDict,
94 &hash_of_hashes_dict)) { 94 &hash_of_hashes_dict)) {
95 hash_of_hashes_dict->RemoveWithoutPathExpansion(hash_store_id_, NULL); 95 hash_of_hashes_dict->RemoveWithoutPathExpansion(hash_store_id_, NULL);
96 } 96 }
97 } 97 }
98 98
99 bool PrefServiceHashStoreContents::IsInitialized() const { 99 bool PrefServiceHashStoreContents::IsInitialized() const {
100 const base::DictionaryValue* pref_hash_dicts = 100 const base::DictionaryValue* pref_hash_dicts =
101 pref_service_->GetDictionary(prefs::kProfilePreferenceHashes); 101 pref_service_->GetDictionary(prefs::kProfilePreferenceHashes);
102 return pref_hash_dicts->GetDictionaryWithoutPathExpansion(hash_store_id_, 102 return pref_hash_dicts->GetDictionaryWithoutPathExpansion(hash_store_id_,
103 NULL); 103 NULL);
104 } 104 }
105 105
106 bool PrefServiceHashStoreContents::GetVersion(int* version) const {
107 DCHECK(version);
108 const base::DictionaryValue* pref_hash_data =
109 pref_service_->GetDictionary(prefs::kProfilePreferenceHashes);
110
111 const base::DictionaryValue* version_dict;
112 return pref_hash_data->GetDictionary(kStoreVersionsDict, &version_dict) &&
113 version_dict->GetIntegerWithoutPathExpansion(hash_store_id_, version);
114 }
115
116 void PrefServiceHashStoreContents::SetVersion(int version) {
117 PrefServiceMutableDictionary(kStoreVersionsDict, pref_service_)
118 ->SetIntegerWithoutPathExpansion(hash_store_id_, version);
119 }
120
121 const base::DictionaryValue* PrefServiceHashStoreContents::GetContents() const { 106 const base::DictionaryValue* PrefServiceHashStoreContents::GetContents() const {
122 const base::DictionaryValue* pref_hash_dicts = 107 const base::DictionaryValue* pref_hash_dicts =
123 pref_service_->GetDictionary(prefs::kProfilePreferenceHashes); 108 pref_service_->GetDictionary(prefs::kProfilePreferenceHashes);
124 const base::DictionaryValue* hashes_dict = NULL; 109 const base::DictionaryValue* hashes_dict = NULL;
125 pref_hash_dicts->GetDictionaryWithoutPathExpansion(hash_store_id_, 110 pref_hash_dicts->GetDictionaryWithoutPathExpansion(hash_store_id_,
126 &hashes_dict); 111 &hashes_dict);
127 return hashes_dict; 112 return hashes_dict;
128 } 113 }
129 114
130 scoped_ptr<HashStoreContents::MutableDictionary> 115 scoped_ptr<HashStoreContents::MutableDictionary>
(...skipping 16 matching lines...) Expand all
147 } 132 }
148 133
149 void PrefServiceHashStoreContents::SetSuperMac(const std::string& super_mac) { 134 void PrefServiceHashStoreContents::SetSuperMac(const std::string& super_mac) {
150 PrefServiceMutableDictionary(kHashOfHashesDict, pref_service_) 135 PrefServiceMutableDictionary(kHashOfHashesDict, pref_service_)
151 ->SetStringWithoutPathExpansion(hash_store_id_, super_mac); 136 ->SetStringWithoutPathExpansion(hash_store_id_, super_mac);
152 } 137 }
153 138
154 void PrefServiceHashStoreContents::CommitPendingWrite() { 139 void PrefServiceHashStoreContents::CommitPendingWrite() {
155 pref_service_->CommitPendingWrite(); 140 pref_service_->CommitPendingWrite();
156 } 141 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698