Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: components/user_prefs/tracked/dictionary_hash_store_contents.cc

Issue 2204943002: Integrate registry_hash_store_contents with the rest of tracked prefs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit and browser tests. GetType => GetUMASuffix Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 std::unique_ptr<HashStoreContents> DictionaryHashStoreContents::MakeCopy()
32 const {
33 NOTREACHED() << "DictionaryHashStoreContents does not support MakeCopy";
34 return nullptr;
35 }
36
37 std::string DictionaryHashStoreContents::GetUMASuffix() const {
38 // To stay consistent with existing reported data, do not append a suffix
39 // when reporting UMA stats for this content.
40 return "";
41 }
42
31 void DictionaryHashStoreContents::Reset() { 43 void DictionaryHashStoreContents::Reset() {
32 storage_->Remove(kPreferenceMACs, NULL); 44 storage_->Remove(kPreferenceMACs, NULL);
33 } 45 }
34 46
35 bool DictionaryHashStoreContents::GetMac(const std::string& path, 47 bool DictionaryHashStoreContents::GetMac(const std::string& path,
36 std::string* out_value) { 48 std::string* out_value) {
37 const base::DictionaryValue* macs_dict = GetContents(); 49 const base::DictionaryValue* macs_dict = GetContents();
38 if (macs_dict) 50 if (macs_dict)
39 return macs_dict->GetString(path, out_value); 51 return macs_dict->GetString(path, out_value);
40 52
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 120
109 base::DictionaryValue* DictionaryHashStoreContents::GetMutableContents( 121 base::DictionaryValue* DictionaryHashStoreContents::GetMutableContents(
110 bool create_if_null) { 122 bool create_if_null) {
111 base::DictionaryValue* macs_dict = NULL; 123 base::DictionaryValue* macs_dict = NULL;
112 storage_->GetDictionary(kPreferenceMACs, &macs_dict); 124 storage_->GetDictionary(kPreferenceMACs, &macs_dict);
113 if (!macs_dict && create_if_null) { 125 if (!macs_dict && create_if_null) {
114 macs_dict = new base::DictionaryValue; 126 macs_dict = new base::DictionaryValue;
115 storage_->Set(kPreferenceMACs, macs_dict); 127 storage_->Set(kPreferenceMACs, macs_dict);
116 } 128 }
117 return macs_dict; 129 return macs_dict;
118 } 130 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698