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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 : storage_(storage) { | 53 : storage_(storage) { |
54 } | 54 } |
55 | 55 |
56 // static | 56 // static |
57 void DictionaryHashStoreContents::RegisterProfilePrefs( | 57 void DictionaryHashStoreContents::RegisterProfilePrefs( |
58 user_prefs::PrefRegistrySyncable* registry) { | 58 user_prefs::PrefRegistrySyncable* registry) { |
59 registry->RegisterDictionaryPref(kPreferenceMACs); | 59 registry->RegisterDictionaryPref(kPreferenceMACs); |
60 registry->RegisterStringPref(kSuperMACPref, std::string()); | 60 registry->RegisterStringPref(kSuperMACPref, std::string()); |
61 } | 61 } |
62 | 62 |
63 std::string DictionaryHashStoreContents::hash_store_id() const { | |
64 return ""; | |
65 } | |
66 | |
67 void DictionaryHashStoreContents::Reset() { | 63 void DictionaryHashStoreContents::Reset() { |
68 storage_->Remove(kPreferenceMACs, NULL); | 64 storage_->Remove(kPreferenceMACs, NULL); |
69 } | 65 } |
70 | 66 |
71 bool DictionaryHashStoreContents::IsInitialized() const { | 67 bool DictionaryHashStoreContents::IsInitialized() const { |
72 return storage_->GetDictionary(kPreferenceMACs, NULL); | 68 return storage_->GetDictionary(kPreferenceMACs, NULL); |
73 } | 69 } |
74 | 70 |
75 const base::DictionaryValue* DictionaryHashStoreContents::GetContents() const { | 71 const base::DictionaryValue* DictionaryHashStoreContents::GetContents() const { |
76 const base::DictionaryValue* mac_dictionary = NULL; | 72 const base::DictionaryValue* mac_dictionary = NULL; |
77 storage_->GetDictionary(kPreferenceMACs, &mac_dictionary); | 73 storage_->GetDictionary(kPreferenceMACs, &mac_dictionary); |
78 return mac_dictionary; | 74 return mac_dictionary; |
79 } | 75 } |
80 | 76 |
81 std::unique_ptr<HashStoreContents::MutableDictionary> | 77 std::unique_ptr<HashStoreContents::MutableDictionary> |
82 DictionaryHashStoreContents::GetMutableContents() { | 78 DictionaryHashStoreContents::GetMutableContents() { |
83 return std::unique_ptr<MutableDictionary>( | 79 return std::unique_ptr<MutableDictionary>( |
84 new MutablePreferenceMacDictionary(storage_)); | 80 new MutablePreferenceMacDictionary(storage_)); |
85 } | 81 } |
86 | 82 |
87 std::string DictionaryHashStoreContents::GetSuperMac() const { | 83 std::string DictionaryHashStoreContents::GetSuperMac() const { |
88 std::string super_mac_string; | 84 std::string super_mac_string; |
89 storage_->GetString(kSuperMACPref, &super_mac_string); | 85 storage_->GetString(kSuperMACPref, &super_mac_string); |
90 return super_mac_string; | 86 return super_mac_string; |
91 } | 87 } |
92 | 88 |
93 void DictionaryHashStoreContents::SetSuperMac(const std::string& super_mac) { | 89 void DictionaryHashStoreContents::SetSuperMac(const std::string& super_mac) { |
94 storage_->SetString(kSuperMACPref, super_mac); | 90 storage_->SetString(kSuperMACPref, super_mac); |
95 } | 91 } |
OLD | NEW |