OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/dictionary_hash_store_contents.h" | 5 #include "components/user_prefs/tracked/dictionary_hash_store_contents.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 : storage_(storage) { | 21 : storage_(storage) { |
22 } | 22 } |
23 | 23 |
24 // static | 24 // static |
25 void DictionaryHashStoreContents::RegisterProfilePrefs( | 25 void DictionaryHashStoreContents::RegisterProfilePrefs( |
26 user_prefs::PrefRegistrySyncable* registry) { | 26 user_prefs::PrefRegistrySyncable* registry) { |
27 registry->RegisterDictionaryPref(kPreferenceMACs); | 27 registry->RegisterDictionaryPref(kPreferenceMACs); |
28 registry->RegisterStringPref(kSuperMACPref, std::string()); | 28 registry->RegisterStringPref(kSuperMACPref, std::string()); |
29 } | 29 } |
30 | 30 |
| 31 bool DictionaryHashStoreContents::IsCopyable() const { |
| 32 return false; |
| 33 } |
| 34 |
| 35 std::unique_ptr<HashStoreContents> DictionaryHashStoreContents::MakeCopy() |
| 36 const { |
| 37 NOTREACHED() << "DictionaryHashStoreContents does not support MakeCopy"; |
| 38 return nullptr; |
| 39 } |
| 40 |
31 base::StringPiece DictionaryHashStoreContents::GetUMASuffix() const { | 41 base::StringPiece DictionaryHashStoreContents::GetUMASuffix() const { |
32 // To stay consistent with existing reported data, do not append a suffix | 42 // To stay consistent with existing reported data, do not append a suffix |
33 // when reporting UMA stats for this content. | 43 // when reporting UMA stats for this content. |
34 return base::StringPiece(); | 44 return base::StringPiece(); |
35 } | 45 } |
36 | 46 |
37 void DictionaryHashStoreContents::Reset() { | 47 void DictionaryHashStoreContents::Reset() { |
38 storage_->Remove(kPreferenceMACs, NULL); | 48 storage_->Remove(kPreferenceMACs, NULL); |
39 } | 49 } |
40 | 50 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 124 |
115 base::DictionaryValue* DictionaryHashStoreContents::GetMutableContents( | 125 base::DictionaryValue* DictionaryHashStoreContents::GetMutableContents( |
116 bool create_if_null) { | 126 bool create_if_null) { |
117 base::DictionaryValue* macs_dict = NULL; | 127 base::DictionaryValue* macs_dict = NULL; |
118 storage_->GetDictionary(kPreferenceMACs, &macs_dict); | 128 storage_->GetDictionary(kPreferenceMACs, &macs_dict); |
119 if (!macs_dict && create_if_null) { | 129 if (!macs_dict && create_if_null) { |
120 macs_dict = new base::DictionaryValue; | 130 macs_dict = new base::DictionaryValue; |
121 storage_->Set(kPreferenceMACs, macs_dict); | 131 storage_->Set(kPreferenceMACs, macs_dict); |
122 } | 132 } |
123 return macs_dict; | 133 return macs_dict; |
124 } | 134 } |
OLD | NEW |