OLD | NEW |
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 "components/user_prefs/tracked/pref_service_hash_store_contents.h" | 5 #include "components/user_prefs/tracked/pref_service_hash_store_contents.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "components/prefs/pref_registry_simple.h" | 8 #include "components/prefs/pref_registry_simple.h" |
9 #include "components/prefs/pref_service.h" | 9 #include "components/prefs/pref_service.h" |
10 #include "components/prefs/scoped_user_pref_update.h" | 10 #include "components/prefs/scoped_user_pref_update.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 const base::DictionaryValue* PrefServiceHashStoreContents::GetContents() const { | 115 const base::DictionaryValue* PrefServiceHashStoreContents::GetContents() const { |
116 const base::DictionaryValue* pref_hash_dicts = | 116 const base::DictionaryValue* pref_hash_dicts = |
117 pref_service_->GetDictionary(kProfilePreferenceHashes); | 117 pref_service_->GetDictionary(kProfilePreferenceHashes); |
118 const base::DictionaryValue* hashes_dict = NULL; | 118 const base::DictionaryValue* hashes_dict = NULL; |
119 pref_hash_dicts->GetDictionaryWithoutPathExpansion(hash_store_id_, | 119 pref_hash_dicts->GetDictionaryWithoutPathExpansion(hash_store_id_, |
120 &hashes_dict); | 120 &hashes_dict); |
121 return hashes_dict; | 121 return hashes_dict; |
122 } | 122 } |
123 | 123 |
124 scoped_ptr<HashStoreContents::MutableDictionary> | 124 std::unique_ptr<HashStoreContents::MutableDictionary> |
125 PrefServiceHashStoreContents::GetMutableContents() { | 125 PrefServiceHashStoreContents::GetMutableContents() { |
126 return scoped_ptr<HashStoreContents::MutableDictionary>( | 126 return std::unique_ptr<HashStoreContents::MutableDictionary>( |
127 new PrefServiceMutableDictionary(hash_store_id_, pref_service_)); | 127 new PrefServiceMutableDictionary(hash_store_id_, pref_service_)); |
128 } | 128 } |
129 | 129 |
130 std::string PrefServiceHashStoreContents::GetSuperMac() const { | 130 std::string PrefServiceHashStoreContents::GetSuperMac() const { |
131 const base::DictionaryValue* pref_hash_dicts = | 131 const base::DictionaryValue* pref_hash_dicts = |
132 pref_service_->GetDictionary(kProfilePreferenceHashes); | 132 pref_service_->GetDictionary(kProfilePreferenceHashes); |
133 const base::DictionaryValue* hash_of_hashes_dict = NULL; | 133 const base::DictionaryValue* hash_of_hashes_dict = NULL; |
134 std::string hash_of_hashes; | 134 std::string hash_of_hashes; |
135 if (pref_hash_dicts->GetDictionaryWithoutPathExpansion( | 135 if (pref_hash_dicts->GetDictionaryWithoutPathExpansion( |
136 kHashOfHashesDict, &hash_of_hashes_dict)) { | 136 kHashOfHashesDict, &hash_of_hashes_dict)) { |
137 hash_of_hashes_dict->GetStringWithoutPathExpansion(hash_store_id_, | 137 hash_of_hashes_dict->GetStringWithoutPathExpansion(hash_store_id_, |
138 &hash_of_hashes); | 138 &hash_of_hashes); |
139 } | 139 } |
140 return hash_of_hashes; | 140 return hash_of_hashes; |
141 } | 141 } |
142 | 142 |
143 void PrefServiceHashStoreContents::SetSuperMac(const std::string& super_mac) { | 143 void PrefServiceHashStoreContents::SetSuperMac(const std::string& super_mac) { |
144 PrefServiceMutableDictionary(kHashOfHashesDict, pref_service_) | 144 PrefServiceMutableDictionary(kHashOfHashesDict, pref_service_) |
145 ->SetStringWithoutPathExpansion(hash_store_id_, super_mac); | 145 ->SetStringWithoutPathExpansion(hash_store_id_, super_mac); |
146 } | 146 } |
OLD | NEW |