| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ | 5 #ifndef CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ |
| 6 #define CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ | 6 #define CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 PrefStore* default_prefs, | 73 PrefStore* default_prefs, |
| 74 PrefModelAssociator* pref_sync_associator, | 74 PrefModelAssociator* pref_sync_associator, |
| 75 PrefNotifier* pref_notifier); | 75 PrefNotifier* pref_notifier); |
| 76 | 76 |
| 77 // Gets the value for the given preference name that has the specified value | 77 // Gets the value for the given preference name that has the specified value |
| 78 // type. Values stored in a PrefStore that have the matching |name| but | 78 // type. Values stored in a PrefStore that have the matching |name| but |
| 79 // a non-matching |type| are silently skipped. Returns true if a valid value | 79 // a non-matching |type| are silently skipped. Returns true if a valid value |
| 80 // was found in any of the available PrefStores. Most callers should use | 80 // was found in any of the available PrefStores. Most callers should use |
| 81 // Preference::GetValue() instead of calling this method directly. | 81 // Preference::GetValue() instead of calling this method directly. |
| 82 bool GetValue(const std::string& name, | 82 bool GetValue(const std::string& name, |
| 83 Value::ValueType type, | 83 base::Value::Type type, |
| 84 const Value** out_value) const; | 84 const Value** out_value) const; |
| 85 | 85 |
| 86 // These methods return true if a preference with the given name is in the | 86 // These methods return true if a preference with the given name is in the |
| 87 // indicated pref store, even if that value is currently being overridden by | 87 // indicated pref store, even if that value is currently being overridden by |
| 88 // a higher-priority source. | 88 // a higher-priority source. |
| 89 bool PrefValueInManagedStore(const char* name) const; | 89 bool PrefValueInManagedStore(const char* name) const; |
| 90 bool PrefValueInExtensionStore(const char* name) const; | 90 bool PrefValueInExtensionStore(const char* name) const; |
| 91 bool PrefValueInUserStore(const char* name) const; | 91 bool PrefValueInUserStore(const char* name) const; |
| 92 | 92 |
| 93 // These methods return true if a preference with the given name is actually | 93 // These methods return true if a preference with the given name is actually |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 // The PrefStore managed by this keeper. | 163 // The PrefStore managed by this keeper. |
| 164 scoped_refptr<PrefStore> pref_store_; | 164 scoped_refptr<PrefStore> pref_store_; |
| 165 | 165 |
| 166 // Type of the pref store. | 166 // Type of the pref store. |
| 167 PrefStoreType type_; | 167 PrefStoreType type_; |
| 168 | 168 |
| 169 DISALLOW_COPY_AND_ASSIGN(PrefStoreKeeper); | 169 DISALLOW_COPY_AND_ASSIGN(PrefStoreKeeper); |
| 170 }; | 170 }; |
| 171 | 171 |
| 172 typedef std::map<std::string, Value::ValueType> PrefTypeMap; | 172 typedef std::map<std::string, base::Value::Type> PrefTypeMap; |
| 173 | 173 |
| 174 friend class PrefValueStorePolicyRefreshTest; | 174 friend class PrefValueStorePolicyRefreshTest; |
| 175 FRIEND_TEST_ALL_PREFIXES(PrefValueStorePolicyRefreshTest, TestPolicyRefresh); | 175 FRIEND_TEST_ALL_PREFIXES(PrefValueStorePolicyRefreshTest, TestPolicyRefresh); |
| 176 FRIEND_TEST_ALL_PREFIXES(PrefValueStorePolicyRefreshTest, | 176 FRIEND_TEST_ALL_PREFIXES(PrefValueStorePolicyRefreshTest, |
| 177 TestRefreshPolicyPrefsCompletion); | 177 TestRefreshPolicyPrefsCompletion); |
| 178 FRIEND_TEST_ALL_PREFIXES(PrefValueStorePolicyRefreshTest, | 178 FRIEND_TEST_ALL_PREFIXES(PrefValueStorePolicyRefreshTest, |
| 179 TestConcurrentPolicyRefresh); | 179 TestConcurrentPolicyRefresh); |
| 180 | 180 |
| 181 // 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 |
| 182 // given PrefStoreType, of the same value type as the preference was | 182 // given PrefStoreType, of the same value type as the preference was |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 // A mapping of preference names to their registered types. | 247 // A mapping of preference names to their registered types. |
| 248 PrefTypeMap pref_types_; | 248 PrefTypeMap pref_types_; |
| 249 | 249 |
| 250 // True if not all of the PrefStores were initialized successfully. | 250 // True if not all of the PrefStores were initialized successfully. |
| 251 bool initialization_failed_; | 251 bool initialization_failed_; |
| 252 | 252 |
| 253 DISALLOW_COPY_AND_ASSIGN(PrefValueStore); | 253 DISALLOW_COPY_AND_ASSIGN(PrefValueStore); |
| 254 }; | 254 }; |
| 255 | 255 |
| 256 #endif // CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ | 256 #endif // CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ |
| OLD | NEW |