| 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 | |
| 41 base::StringPiece DictionaryHashStoreContents::GetUMASuffix() const { | 31 base::StringPiece DictionaryHashStoreContents::GetUMASuffix() const { |
| 42 // To stay consistent with existing reported data, do not append a suffix | 32 // To stay consistent with existing reported data, do not append a suffix |
| 43 // when reporting UMA stats for this content. | 33 // when reporting UMA stats for this content. |
| 44 return base::StringPiece(); | 34 return base::StringPiece(); |
| 45 } | 35 } |
| 46 | 36 |
| 47 void DictionaryHashStoreContents::Reset() { | 37 void DictionaryHashStoreContents::Reset() { |
| 48 storage_->Remove(kPreferenceMACs, NULL); | 38 storage_->Remove(kPreferenceMACs, NULL); |
| 49 } | 39 } |
| 50 | 40 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 | 114 |
| 125 base::DictionaryValue* DictionaryHashStoreContents::GetMutableContents( | 115 base::DictionaryValue* DictionaryHashStoreContents::GetMutableContents( |
| 126 bool create_if_null) { | 116 bool create_if_null) { |
| 127 base::DictionaryValue* macs_dict = NULL; | 117 base::DictionaryValue* macs_dict = NULL; |
| 128 storage_->GetDictionary(kPreferenceMACs, &macs_dict); | 118 storage_->GetDictionary(kPreferenceMACs, &macs_dict); |
| 129 if (!macs_dict && create_if_null) { | 119 if (!macs_dict && create_if_null) { |
| 130 macs_dict = new base::DictionaryValue; | 120 macs_dict = new base::DictionaryValue; |
| 131 storage_->Set(kPreferenceMACs, macs_dict); | 121 storage_->Set(kPreferenceMACs, macs_dict); |
| 132 } | 122 } |
| 133 return macs_dict; | 123 return macs_dict; |
| 134 } | 124 } |
| OLD | NEW |