| 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 COMPONENTS_PREFS_PREF_VALUE_STORE_H_ | 5 #ifndef COMPONENTS_PREFS_PREF_VALUE_STORE_H_ |
| 6 #define COMPONENTS_PREFS_PREF_VALUE_STORE_H_ | 6 #define COMPONENTS_PREFS_PREF_VALUE_STORE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <type_traits> | 10 #include <type_traits> |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // | 73 // |
| 74 // |pref_notifier| facilitates broadcasting preference change notifications | 74 // |pref_notifier| facilitates broadcasting preference change notifications |
| 75 // to the world. | 75 // to the world. |
| 76 PrefValueStore(PrefStore* managed_prefs, | 76 PrefValueStore(PrefStore* managed_prefs, |
| 77 PrefStore* supervised_user_prefs, | 77 PrefStore* supervised_user_prefs, |
| 78 PrefStore* extension_prefs, | 78 PrefStore* extension_prefs, |
| 79 PrefStore* command_line_prefs, | 79 PrefStore* command_line_prefs, |
| 80 PrefStore* user_prefs, | 80 PrefStore* user_prefs, |
| 81 PrefStore* recommended_prefs, | 81 PrefStore* recommended_prefs, |
| 82 PrefStore* default_prefs, | 82 PrefStore* default_prefs, |
| 83 PrefNotifier* pref_notifier); | 83 PrefNotifier* pref_notifier, |
| 84 PrefStore* incognito_prefs = nullptr); |
| 85 // TODO(tibell): Add incognito store as an option. |
| 84 virtual ~PrefValueStore(); | 86 virtual ~PrefValueStore(); |
| 85 | 87 |
| 86 // Creates a clone of this PrefValueStore with PrefStores overwritten | 88 // Creates a clone of this PrefValueStore with PrefStores overwritten |
| 87 // by the parameters passed, if unequal NULL. | 89 // by the parameters passed, if unequal NULL. |
| 88 PrefValueStore* CloneAndSpecialize(PrefStore* managed_prefs, | 90 PrefValueStore* CloneAndSpecialize(PrefStore* managed_prefs, |
| 89 PrefStore* supervised_user_prefs, | 91 PrefStore* supervised_user_prefs, |
| 90 PrefStore* extension_prefs, | 92 PrefStore* extension_prefs, |
| 91 PrefStore* command_line_prefs, | 93 PrefStore* command_line_prefs, |
| 92 PrefStore* user_prefs, | 94 PrefStore* user_prefs, |
| 93 PrefStore* recommended_prefs, | 95 PrefStore* recommended_prefs, |
| 94 PrefStore* default_prefs, | 96 PrefStore* default_prefs, |
| 95 PrefNotifier* pref_notifier); | 97 PrefNotifier* pref_notifier, |
| 98 PrefStore* incognito_prefs = nullptr); |
| 96 | 99 |
| 97 // A PrefValueStore can have exactly one callback that is directly | 100 // A PrefValueStore can have exactly one callback that is directly |
| 98 // notified of preferences changing in the store. This does not | 101 // notified of preferences changing in the store. This does not |
| 99 // filter through the PrefNotifier mechanism, which may not forward | 102 // filter through the PrefNotifier mechanism, which may not forward |
| 100 // certain changes (e.g. unregistered prefs). | 103 // certain changes (e.g. unregistered prefs). |
| 101 void set_callback(const PrefChangedCallback& callback); | 104 void set_callback(const PrefChangedCallback& callback); |
| 102 | 105 |
| 103 // Gets the value for the given preference name that has the specified value | 106 // Gets the value for the given preference name that has the specified value |
| 104 // type. Values stored in a PrefStore that have the matching |name| but | 107 // type. Values stored in a PrefStore that have the matching |name| but |
| 105 // a non-matching |type| are silently skipped. Returns true if a valid value | 108 // a non-matching |type| are silently skipped. Returns true if a valid value |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 struct hash<PrefValueStore::PrefStoreType> { | 270 struct hash<PrefValueStore::PrefStoreType> { |
| 268 size_t operator()(PrefValueStore::PrefStoreType type) const { | 271 size_t operator()(PrefValueStore::PrefStoreType type) const { |
| 269 return std::hash< | 272 return std::hash< |
| 270 std::underlying_type<PrefValueStore::PrefStoreType>::type>()(type); | 273 std::underlying_type<PrefValueStore::PrefStoreType>::type>()(type); |
| 271 } | 274 } |
| 272 }; | 275 }; |
| 273 | 276 |
| 274 } // namespace std | 277 } // namespace std |
| 275 | 278 |
| 276 #endif // COMPONENTS_PREFS_PREF_VALUE_STORE_H_ | 279 #endif // COMPONENTS_PREFS_PREF_VALUE_STORE_H_ |
| OLD | NEW |