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 HashStoreContentsType DictionaryHashStoreContents::GetType() const { |
| 32 return HashStoreContentsType::DICTIONARY_HASH_STORE_CONTENTS; |
| 33 } |
| 34 |
31 void DictionaryHashStoreContents::Reset() { | 35 void DictionaryHashStoreContents::Reset() { |
32 storage_->Remove(kPreferenceMACs, NULL); | 36 storage_->Remove(kPreferenceMACs, NULL); |
33 } | 37 } |
34 | 38 |
35 bool DictionaryHashStoreContents::GetMac(const std::string& path, | 39 bool DictionaryHashStoreContents::GetMac(const std::string& path, |
36 std::string* out_value) { | 40 std::string* out_value) { |
37 const base::DictionaryValue* macs_dict = GetContents(); | 41 const base::DictionaryValue* macs_dict = GetContents(); |
38 if (macs_dict) | 42 if (macs_dict) |
39 return macs_dict->GetString(path, out_value); | 43 return macs_dict->GetString(path, out_value); |
40 | 44 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 112 |
109 base::DictionaryValue* DictionaryHashStoreContents::GetMutableContents( | 113 base::DictionaryValue* DictionaryHashStoreContents::GetMutableContents( |
110 bool create_if_null) { | 114 bool create_if_null) { |
111 base::DictionaryValue* macs_dict = NULL; | 115 base::DictionaryValue* macs_dict = NULL; |
112 storage_->GetDictionary(kPreferenceMACs, &macs_dict); | 116 storage_->GetDictionary(kPreferenceMACs, &macs_dict); |
113 if (!macs_dict && create_if_null) { | 117 if (!macs_dict && create_if_null) { |
114 macs_dict = new base::DictionaryValue; | 118 macs_dict = new base::DictionaryValue; |
115 storage_->Set(kPreferenceMACs, macs_dict); | 119 storage_->Set(kPreferenceMACs, macs_dict); |
116 } | 120 } |
117 return macs_dict; | 121 return macs_dict; |
118 } | 122 } |
OLD | NEW |