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 "services/preferences/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" |
11 #include "components/pref_registry/pref_registry_syncable.h" | 11 #include "components/pref_registry/pref_registry_syncable.h" |
12 #include "components/prefs/persistent_pref_store.h" | 12 #include "components/prefs/persistent_pref_store.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 const char kPreferenceMACs[] = "protection.macs"; | 15 const char kPreferenceMACs[] = "protection.macs"; |
16 const char kSuperMACPref[] = "protection.super_mac"; | 16 const char kSuperMACPref[] = "protection.super_mac"; |
17 } | 17 } |
18 | 18 |
19 DictionaryHashStoreContents::DictionaryHashStoreContents( | 19 DictionaryHashStoreContents::DictionaryHashStoreContents( |
20 base::DictionaryValue* storage) | 20 base::DictionaryValue* storage) |
21 : storage_(storage) { | 21 : storage_(storage) {} |
22 } | |
23 | 22 |
24 // static | 23 // static |
25 void DictionaryHashStoreContents::RegisterProfilePrefs( | 24 void DictionaryHashStoreContents::RegisterProfilePrefs( |
26 user_prefs::PrefRegistrySyncable* registry) { | 25 user_prefs::PrefRegistrySyncable* registry) { |
27 registry->RegisterDictionaryPref(kPreferenceMACs); | 26 registry->RegisterDictionaryPref(kPreferenceMACs); |
28 registry->RegisterStringPref(kSuperMACPref, std::string()); | 27 registry->RegisterStringPref(kSuperMACPref, std::string()); |
29 } | 28 } |
30 | 29 |
31 bool DictionaryHashStoreContents::IsCopyable() const { | 30 bool DictionaryHashStoreContents::IsCopyable() const { |
32 return false; | 31 return false; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 base::DictionaryValue* DictionaryHashStoreContents::GetMutableContents( | 124 base::DictionaryValue* DictionaryHashStoreContents::GetMutableContents( |
126 bool create_if_null) { | 125 bool create_if_null) { |
127 base::DictionaryValue* macs_dict = NULL; | 126 base::DictionaryValue* macs_dict = NULL; |
128 storage_->GetDictionary(kPreferenceMACs, &macs_dict); | 127 storage_->GetDictionary(kPreferenceMACs, &macs_dict); |
129 if (!macs_dict && create_if_null) { | 128 if (!macs_dict && create_if_null) { |
130 macs_dict = new base::DictionaryValue; | 129 macs_dict = new base::DictionaryValue; |
131 storage_->Set(kPreferenceMACs, macs_dict); | 130 storage_->Set(kPreferenceMACs, macs_dict); |
132 } | 131 } |
133 return macs_dict; | 132 return macs_dict; |
134 } | 133 } |
OLD | NEW |