OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 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/segregated_pref_store.h" | 5 #include "components/user_prefs/tracked/segregated_pref_store.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 | 10 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 selected_pref_store_->IsInitializationComplete(); | 77 selected_pref_store_->IsInitializationComplete(); |
78 } | 78 } |
79 | 79 |
80 bool SegregatedPrefStore::GetValue(const std::string& key, | 80 bool SegregatedPrefStore::GetValue(const std::string& key, |
81 const base::Value** result) const { | 81 const base::Value** result) const { |
82 return StoreForKey(key)->GetValue(key, result); | 82 return StoreForKey(key)->GetValue(key, result); |
83 } | 83 } |
84 | 84 |
85 void SegregatedPrefStore::SetValue(const std::string& key, | 85 void SegregatedPrefStore::SetValue(const std::string& key, |
86 scoped_ptr<base::Value> value, | 86 scoped_ptr<base::Value> value, |
87 uint32 flags) { | 87 uint32_t flags) { |
88 StoreForKey(key)->SetValue(key, value.Pass(), flags); | 88 StoreForKey(key)->SetValue(key, value.Pass(), flags); |
89 } | 89 } |
90 | 90 |
91 void SegregatedPrefStore::RemoveValue(const std::string& key, uint32 flags) { | 91 void SegregatedPrefStore::RemoveValue(const std::string& key, uint32_t flags) { |
92 StoreForKey(key)->RemoveValue(key, flags); | 92 StoreForKey(key)->RemoveValue(key, flags); |
93 } | 93 } |
94 | 94 |
95 bool SegregatedPrefStore::GetMutableValue(const std::string& key, | 95 bool SegregatedPrefStore::GetMutableValue(const std::string& key, |
96 base::Value** result) { | 96 base::Value** result) { |
97 return StoreForKey(key)->GetMutableValue(key, result); | 97 return StoreForKey(key)->GetMutableValue(key, result); |
98 } | 98 } |
99 | 99 |
100 void SegregatedPrefStore::ReportValueChanged(const std::string& key, | 100 void SegregatedPrefStore::ReportValueChanged(const std::string& key, |
101 uint32 flags) { | 101 uint32_t flags) { |
102 StoreForKey(key)->ReportValueChanged(key, flags); | 102 StoreForKey(key)->ReportValueChanged(key, flags); |
103 } | 103 } |
104 | 104 |
105 void SegregatedPrefStore::SetValueSilently(const std::string& key, | 105 void SegregatedPrefStore::SetValueSilently(const std::string& key, |
106 scoped_ptr<base::Value> value, | 106 scoped_ptr<base::Value> value, |
107 uint32 flags) { | 107 uint32_t flags) { |
108 StoreForKey(key)->SetValueSilently(key, value.Pass(), flags); | 108 StoreForKey(key)->SetValueSilently(key, value.Pass(), flags); |
109 } | 109 } |
110 | 110 |
111 bool SegregatedPrefStore::ReadOnly() const { | 111 bool SegregatedPrefStore::ReadOnly() const { |
112 return selected_pref_store_->ReadOnly() || default_pref_store_->ReadOnly(); | 112 return selected_pref_store_->ReadOnly() || default_pref_store_->ReadOnly(); |
113 } | 113 } |
114 | 114 |
115 PersistentPrefStore::PrefReadError SegregatedPrefStore::GetReadError() const { | 115 PersistentPrefStore::PrefReadError SegregatedPrefStore::GetReadError() const { |
116 PersistentPrefStore::PrefReadError read_error = | 116 PersistentPrefStore::PrefReadError read_error = |
117 default_pref_store_->GetReadError(); | 117 default_pref_store_->GetReadError(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 ? selected_pref_store_ | 164 ? selected_pref_store_ |
165 : default_pref_store_).get(); | 165 : default_pref_store_).get(); |
166 } | 166 } |
167 | 167 |
168 const PersistentPrefStore* SegregatedPrefStore::StoreForKey( | 168 const PersistentPrefStore* SegregatedPrefStore::StoreForKey( |
169 const std::string& key) const { | 169 const std::string& key) const { |
170 return (ContainsKey(selected_preference_names_, key) | 170 return (ContainsKey(selected_preference_names_, key) |
171 ? selected_pref_store_ | 171 ? selected_pref_store_ |
172 : default_pref_store_).get(); | 172 : default_pref_store_).get(); |
173 } | 173 } |
OLD | NEW |