| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef BASE_PREFS_PREF_VALUE_STORE_H_ | 5 #ifndef BASE_PREFS_PREF_VALUE_STORE_H_ |
| 6 #define BASE_PREFS_PREF_VALUE_STORE_H_ | 6 #define BASE_PREFS_PREF_VALUE_STORE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/gtest_prod_util.h" | |
| 15 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 16 #include "base/prefs/base_prefs_export.h" | 15 #include "base/prefs/base_prefs_export.h" |
| 17 #include "base/prefs/pref_store.h" | 16 #include "base/prefs/pref_store.h" |
| 18 #include "base/values.h" | 17 #include "base/values.h" |
| 19 | 18 |
| 20 class PrefNotifier; | 19 class PrefNotifier; |
| 21 class PrefStore; | 20 class PrefStore; |
| 22 | 21 |
| 23 // The PrefValueStore manages various sources of values for Preferences | 22 // The PrefValueStore manages various sources of values for Preferences |
| 24 // (e.g., configuration policies, extensions, and user settings). It returns | 23 // (e.g., configuration policies, extensions, and user settings). It returns |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 scoped_refptr<PrefStore> pref_store_; | 171 scoped_refptr<PrefStore> pref_store_; |
| 173 | 172 |
| 174 // Type of the pref store. | 173 // Type of the pref store. |
| 175 PrefStoreType type_; | 174 PrefStoreType type_; |
| 176 | 175 |
| 177 DISALLOW_COPY_AND_ASSIGN(PrefStoreKeeper); | 176 DISALLOW_COPY_AND_ASSIGN(PrefStoreKeeper); |
| 178 }; | 177 }; |
| 179 | 178 |
| 180 typedef std::map<std::string, base::Value::Type> PrefTypeMap; | 179 typedef std::map<std::string, base::Value::Type> PrefTypeMap; |
| 181 | 180 |
| 182 friend class PrefValueStorePolicyRefreshTest; | |
| 183 FRIEND_TEST_ALL_PREFIXES(PrefValueStorePolicyRefreshTest, TestPolicyRefresh); | |
| 184 FRIEND_TEST_ALL_PREFIXES(PrefValueStorePolicyRefreshTest, | |
| 185 TestRefreshPolicyPrefsCompletion); | |
| 186 FRIEND_TEST_ALL_PREFIXES(PrefValueStorePolicyRefreshTest, | |
| 187 TestConcurrentPolicyRefresh); | |
| 188 | |
| 189 // Returns true if the preference with the given name has a value in the | 181 // Returns true if the preference with the given name has a value in the |
| 190 // given PrefStoreType, of the same value type as the preference was | 182 // given PrefStoreType, of the same value type as the preference was |
| 191 // registered with. | 183 // registered with. |
| 192 bool PrefValueInStore(const std::string& name, PrefStoreType store) const; | 184 bool PrefValueInStore(const std::string& name, PrefStoreType store) const; |
| 193 | 185 |
| 194 // Returns true if a preference has an explicit value in any of the | 186 // Returns true if a preference has an explicit value in any of the |
| 195 // stores in the range specified by |first_checked_store| and | 187 // stores in the range specified by |first_checked_store| and |
| 196 // |last_checked_store|, even if that value is currently being | 188 // |last_checked_store|, even if that value is currently being |
| 197 // overridden by a higher-priority store. | 189 // overridden by a higher-priority store. |
| 198 bool PrefValueInStoreRange(const std::string& name, | 190 bool PrefValueInStoreRange(const std::string& name, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 // A mapping of preference names to their registered types. | 251 // A mapping of preference names to their registered types. |
| 260 PrefTypeMap pref_types_; | 252 PrefTypeMap pref_types_; |
| 261 | 253 |
| 262 // True if not all of the PrefStores were initialized successfully. | 254 // True if not all of the PrefStores were initialized successfully. |
| 263 bool initialization_failed_; | 255 bool initialization_failed_; |
| 264 | 256 |
| 265 DISALLOW_COPY_AND_ASSIGN(PrefValueStore); | 257 DISALLOW_COPY_AND_ASSIGN(PrefValueStore); |
| 266 }; | 258 }; |
| 267 | 259 |
| 268 #endif // BASE_PREFS_PREF_VALUE_STORE_H_ | 260 #endif // BASE_PREFS_PREF_VALUE_STORE_H_ |
| OLD | NEW |