| 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> |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 PREF_STORE_TYPE_MAX = DEFAULT_STORE | 142 PREF_STORE_TYPE_MAX = DEFAULT_STORE |
| 143 }; | 143 }; |
| 144 | 144 |
| 145 // Keeps a PrefStore reference on behalf of the PrefValueStore and monitors | 145 // Keeps a PrefStore reference on behalf of the PrefValueStore and monitors |
| 146 // the PrefStore for changes, forwarding notifications to PrefValueStore. This | 146 // the PrefStore for changes, forwarding notifications to PrefValueStore. This |
| 147 // indirection is here for the sake of disambiguating notifications from the | 147 // indirection is here for the sake of disambiguating notifications from the |
| 148 // individual PrefStores. | 148 // individual PrefStores. |
| 149 class PrefStoreKeeper : public PrefStore::Observer { | 149 class PrefStoreKeeper : public PrefStore::Observer { |
| 150 public: | 150 public: |
| 151 PrefStoreKeeper(); | 151 PrefStoreKeeper(); |
| 152 virtual ~PrefStoreKeeper(); | 152 ~PrefStoreKeeper() override; |
| 153 | 153 |
| 154 // Takes ownership of |pref_store|. | 154 // Takes ownership of |pref_store|. |
| 155 void Initialize(PrefValueStore* store, | 155 void Initialize(PrefValueStore* store, |
| 156 PrefStore* pref_store, | 156 PrefStore* pref_store, |
| 157 PrefStoreType type); | 157 PrefStoreType type); |
| 158 | 158 |
| 159 PrefStore* store() { return pref_store_.get(); } | 159 PrefStore* store() { return pref_store_.get(); } |
| 160 const PrefStore* store() const { return pref_store_.get(); } | 160 const PrefStore* store() const { return pref_store_.get(); } |
| 161 | 161 |
| 162 private: | 162 private: |
| 163 // PrefStore::Observer implementation. | 163 // PrefStore::Observer implementation. |
| 164 virtual void OnPrefValueChanged(const std::string& key) override; | 164 void OnPrefValueChanged(const std::string& key) override; |
| 165 virtual void OnInitializationCompleted(bool succeeded) override; | 165 void OnInitializationCompleted(bool succeeded) override; |
| 166 | 166 |
| 167 // PrefValueStore this keeper is part of. | 167 // PrefValueStore this keeper is part of. |
| 168 PrefValueStore* pref_value_store_; | 168 PrefValueStore* pref_value_store_; |
| 169 | 169 |
| 170 // The PrefStore managed by this keeper. | 170 // The PrefStore managed by this keeper. |
| 171 scoped_refptr<PrefStore> pref_store_; | 171 scoped_refptr<PrefStore> pref_store_; |
| 172 | 172 |
| 173 // Type of the pref store. | 173 // Type of the pref store. |
| 174 PrefStoreType type_; | 174 PrefStoreType type_; |
| 175 | 175 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 // A mapping of preference names to their registered types. | 258 // A mapping of preference names to their registered types. |
| 259 PrefTypeMap pref_types_; | 259 PrefTypeMap pref_types_; |
| 260 | 260 |
| 261 // True if not all of the PrefStores were initialized successfully. | 261 // True if not all of the PrefStores were initialized successfully. |
| 262 bool initialization_failed_; | 262 bool initialization_failed_; |
| 263 | 263 |
| 264 DISALLOW_COPY_AND_ASSIGN(PrefValueStore); | 264 DISALLOW_COPY_AND_ASSIGN(PrefValueStore); |
| 265 }; | 265 }; |
| 266 | 266 |
| 267 #endif // BASE_PREFS_PREF_VALUE_STORE_H_ | 267 #endif // BASE_PREFS_PREF_VALUE_STORE_H_ |
| OLD | NEW |