| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_FILTER_H_ | 5 #ifndef COMPONENTS_PREFS_PREF_FILTER_H_ |
| 6 #define COMPONENTS_PREFS_PREF_FILTER_H_ | 6 #define COMPONENTS_PREFS_PREF_FILTER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
| 13 #include "components/prefs/base_prefs_export.h" | 13 #include "components/prefs/base_prefs_export.h" |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class DictionaryValue; | 16 class DictionaryValue; |
| 17 class Value; | |
| 18 } // namespace base | 17 } // namespace base |
| 19 | 18 |
| 20 // Filters preferences as they are loaded from disk or updated at runtime. | 19 // Filters preferences as they are loaded from disk or updated at runtime. |
| 21 // Currently supported only by JsonPrefStore. | 20 // Currently supported only by JsonPrefStore. |
| 22 class COMPONENTS_PREFS_EXPORT PrefFilter { | 21 class COMPONENTS_PREFS_EXPORT PrefFilter { |
| 23 public: | 22 public: |
| 24 // A pair of pre-write and post-write callbacks. | 23 // A pair of pre-write and post-write callbacks. |
| 25 using OnWriteCallbackPair = | 24 using OnWriteCallbackPair = |
| 26 std::pair<base::Closure, base::Callback<void(bool success)>>; | 25 std::pair<base::Closure, base::Callback<void(bool success)>>; |
| 27 | 26 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 55 // |pref_store_contents| will be persisted to disk and also affect the | 54 // |pref_store_contents| will be persisted to disk and also affect the |
| 56 // in-memory state. | 55 // in-memory state. |
| 57 // If the returned callbacks are non-null, they will be registered to be | 56 // If the returned callbacks are non-null, they will be registered to be |
| 58 // invoked synchronously after the next write (from the I/O TaskRunner so they | 57 // invoked synchronously after the next write (from the I/O TaskRunner so they |
| 59 // must not be bound to thread-unsafe member state). | 58 // must not be bound to thread-unsafe member state). |
| 60 virtual OnWriteCallbackPair FilterSerializeData( | 59 virtual OnWriteCallbackPair FilterSerializeData( |
| 61 base::DictionaryValue* pref_store_contents) = 0; | 60 base::DictionaryValue* pref_store_contents) = 0; |
| 62 }; | 61 }; |
| 63 | 62 |
| 64 #endif // COMPONENTS_PREFS_PREF_FILTER_H_ | 63 #endif // COMPONENTS_PREFS_PREF_FILTER_H_ |
| OLD | NEW |