| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 class InterceptingPrefFilter : public PrefFilter { | 69 class InterceptingPrefFilter : public PrefFilter { |
| 70 public: | 70 public: |
| 71 InterceptingPrefFilter(); | 71 InterceptingPrefFilter(); |
| 72 ~InterceptingPrefFilter() override; | 72 ~InterceptingPrefFilter() override; |
| 73 | 73 |
| 74 // PrefFilter implementation: | 74 // PrefFilter implementation: |
| 75 void FilterOnLoad( | 75 void FilterOnLoad( |
| 76 const PostFilterOnLoadCallback& post_filter_on_load_callback, | 76 const PostFilterOnLoadCallback& post_filter_on_load_callback, |
| 77 std::unique_ptr<base::DictionaryValue> pref_store_contents) override; | 77 std::unique_ptr<base::DictionaryValue> pref_store_contents) override; |
| 78 void FilterUpdate(const std::string& path) override {} | 78 void FilterUpdate(const std::string& path) override {} |
| 79 void FilterSerializeData( | 79 base::Callback<void(bool)> FilterSerializeData( |
| 80 base::DictionaryValue* pref_store_contents) override {} | 80 base::DictionaryValue* pref_store_contents) override { |
| 81 return base::Callback<void(bool)>(); |
| 82 } |
| 81 | 83 |
| 82 bool has_intercepted_prefs() const { return intercepted_prefs_ != NULL; } | 84 bool has_intercepted_prefs() const { return intercepted_prefs_ != NULL; } |
| 83 | 85 |
| 84 // Finalize an intercepted read, handing |intercepted_prefs_| back to its | 86 // Finalize an intercepted read, handing |intercepted_prefs_| back to its |
| 85 // JsonPrefStore. | 87 // JsonPrefStore. |
| 86 void ReleasePrefs(); | 88 void ReleasePrefs(); |
| 87 | 89 |
| 88 private: | 90 private: |
| 89 PostFilterOnLoadCallback post_filter_on_load_callback_; | 91 PostFilterOnLoadCallback post_filter_on_load_callback_; |
| 90 std::unique_ptr<base::DictionaryValue> intercepted_prefs_; | 92 std::unique_ptr<base::DictionaryValue> intercepted_prefs_; |
| (...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 write_callback_observer_.ObserveNextWriteCallback( | 1171 write_callback_observer_.ObserveNextWriteCallback( |
| 1170 soon_out_of_scope_pref_store.get()); | 1172 soon_out_of_scope_pref_store.get()); |
| 1171 file_writer->WriteNow(MakeUnique<std::string>("foo")); | 1173 file_writer->WriteNow(MakeUnique<std::string>("foo")); |
| 1172 } | 1174 } |
| 1173 RunLoop().RunUntilIdle(); | 1175 RunLoop().RunUntilIdle(); |
| 1174 EXPECT_FALSE(successful_write_reply_observer_.GetAndResetObservationState()); | 1176 EXPECT_FALSE(successful_write_reply_observer_.GetAndResetObservationState()); |
| 1175 EXPECT_EQ(CALLED_WITH_SUCCESS, | 1177 EXPECT_EQ(CALLED_WITH_SUCCESS, |
| 1176 write_callback_observer_.GetAndResetObservationState()); | 1178 write_callback_observer_.GetAndResetObservationState()); |
| 1177 } | 1179 } |
| 1178 | 1180 |
| 1179 } // namespace base | 1181 } // namespace base |
| OLD | NEW |