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 #include "components/prefs/json_pref_store.h" | 5 #include "components/prefs/json_pref_store.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 class InterceptingPrefFilter : public PrefFilter { | 68 class InterceptingPrefFilter : public PrefFilter { |
69 public: | 69 public: |
70 InterceptingPrefFilter(); | 70 InterceptingPrefFilter(); |
71 ~InterceptingPrefFilter() override; | 71 ~InterceptingPrefFilter() override; |
72 | 72 |
73 // PrefFilter implementation: | 73 // PrefFilter implementation: |
74 void FilterOnLoad( | 74 void FilterOnLoad( |
75 const PostFilterOnLoadCallback& post_filter_on_load_callback, | 75 const PostFilterOnLoadCallback& post_filter_on_load_callback, |
76 std::unique_ptr<base::DictionaryValue> pref_store_contents) override; | 76 std::unique_ptr<base::DictionaryValue> pref_store_contents) override; |
77 void FilterUpdate(const std::string& path) override {} | 77 void FilterUpdate(const std::string& path) override {} |
78 void FilterSerializeData( | 78 base::Callback<void(bool)> FilterSerializeData( |
79 base::DictionaryValue* pref_store_contents) override {} | 79 base::DictionaryValue* pref_store_contents) override { |
| 80 return base::Callback<void(bool)>(); |
| 81 } |
80 | 82 |
81 bool has_intercepted_prefs() const { return intercepted_prefs_ != NULL; } | 83 bool has_intercepted_prefs() const { return intercepted_prefs_ != NULL; } |
82 | 84 |
83 // Finalize an intercepted read, handing |intercepted_prefs_| back to its | 85 // Finalize an intercepted read, handing |intercepted_prefs_| back to its |
84 // JsonPrefStore. | 86 // JsonPrefStore. |
85 void ReleasePrefs(); | 87 void ReleasePrefs(); |
86 | 88 |
87 private: | 89 private: |
88 PostFilterOnLoadCallback post_filter_on_load_callback_; | 90 PostFilterOnLoadCallback post_filter_on_load_callback_; |
89 std::unique_ptr<base::DictionaryValue> intercepted_prefs_; | 91 std::unique_ptr<base::DictionaryValue> intercepted_prefs_; |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 ASSERT_TRUE(file_writer->HasPendingWrite()); | 954 ASSERT_TRUE(file_writer->HasPendingWrite()); |
953 | 955 |
954 // Call CommitPendingWrite and check that the lossy pref is there with the | 956 // Call CommitPendingWrite and check that the lossy pref is there with the |
955 // last value set above. | 957 // last value set above. |
956 pref_store->CommitPendingWrite(); | 958 pref_store->CommitPendingWrite(); |
957 ASSERT_FALSE(file_writer->HasPendingWrite()); | 959 ASSERT_FALSE(file_writer->HasPendingWrite()); |
958 ASSERT_EQ("{\"lossy\":\"lossy\"}", GetTestFileContents()); | 960 ASSERT_EQ("{\"lossy\":\"lossy\"}", GetTestFileContents()); |
959 } | 961 } |
960 | 962 |
961 } // namespace base | 963 } // namespace base |
OLD | NEW |