| 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_OVERLAY_USER_PREF_STORE_H_ | 5 #ifndef COMPONENTS_PREFS_OVERLAY_USER_PREF_STORE_H_ |
| 6 #define COMPONENTS_PREFS_OVERLAY_USER_PREF_STORE_H_ | 6 #define COMPONENTS_PREFS_OVERLAY_USER_PREF_STORE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 PrefReadError GetReadError() const override; | 56 PrefReadError GetReadError() const override; |
| 57 PrefReadError ReadPrefs() override; | 57 PrefReadError ReadPrefs() override; |
| 58 void ReadPrefsAsync(ReadErrorDelegate* delegate) override; | 58 void ReadPrefsAsync(ReadErrorDelegate* delegate) override; |
| 59 void CommitPendingWrite(base::OnceClosure done_callback) override; | 59 void CommitPendingWrite(base::OnceClosure done_callback) override; |
| 60 void SchedulePendingLossyWrites() override; | 60 void SchedulePendingLossyWrites() override; |
| 61 void ReportValueChanged(const std::string& key, uint32_t flags) override; | 61 void ReportValueChanged(const std::string& key, uint32_t flags) override; |
| 62 | 62 |
| 63 void RegisterOverlayPref(const std::string& key); | 63 void RegisterOverlayPref(const std::string& key); |
| 64 | 64 |
| 65 void ClearMutableValues() override; | 65 void ClearMutableValues() override; |
| 66 void OnStoreDeletionFromDisk() override; |
| 66 | 67 |
| 67 protected: | 68 protected: |
| 68 ~OverlayUserPrefStore() override; | 69 ~OverlayUserPrefStore() override; |
| 69 | 70 |
| 70 private: | 71 private: |
| 71 typedef std::set<std::string> NamesSet; | 72 typedef std::set<std::string> NamesSet; |
| 72 class ObserverAdapter; | 73 class ObserverAdapter; |
| 73 | 74 |
| 74 void OnPrefValueChanged(bool overlay, const std::string& key); | 75 void OnPrefValueChanged(bool overlay, const std::string& key); |
| 75 void OnInitializationCompleted(bool overlay, bool succeeded); | 76 void OnInitializationCompleted(bool overlay, bool succeeded); |
| 76 | 77 |
| 77 // Returns true if |key| corresponds to a preference that shall be stored in | 78 // Returns true if |key| corresponds to a preference that shall be stored in |
| 78 // an in-memory PrefStore that is not persisted to disk. | 79 // an in-memory PrefStore that is not persisted to disk. |
| 79 bool ShallBeStoredInOverlay(const std::string& key) const; | 80 bool ShallBeStoredInOverlay(const std::string& key) const; |
| 80 | 81 |
| 81 base::ObserverList<PrefStore::Observer, true> observers_; | 82 base::ObserverList<PrefStore::Observer, true> observers_; |
| 82 std::unique_ptr<ObserverAdapter> overlay_observer_; | 83 std::unique_ptr<ObserverAdapter> overlay_observer_; |
| 83 std::unique_ptr<ObserverAdapter> underlay_observer_; | 84 std::unique_ptr<ObserverAdapter> underlay_observer_; |
| 84 scoped_refptr<PersistentPrefStore> overlay_; | 85 scoped_refptr<PersistentPrefStore> overlay_; |
| 85 scoped_refptr<PersistentPrefStore> underlay_; | 86 scoped_refptr<PersistentPrefStore> underlay_; |
| 86 NamesSet overlay_names_set_; | 87 NamesSet overlay_names_set_; |
| 87 NamesSet written_overlay_names_; | 88 NamesSet written_overlay_names_; |
| 88 | 89 |
| 89 DISALLOW_COPY_AND_ASSIGN(OverlayUserPrefStore); | 90 DISALLOW_COPY_AND_ASSIGN(OverlayUserPrefStore); |
| 90 }; | 91 }; |
| 91 | 92 |
| 92 #endif // COMPONENTS_PREFS_OVERLAY_USER_PREF_STORE_H_ | 93 #endif // COMPONENTS_PREFS_OVERLAY_USER_PREF_STORE_H_ |
| OLD | NEW |