| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 // PrefFilter implementation: | 75 // PrefFilter implementation: |
| 76 void FilterOnLoad( | 76 void FilterOnLoad( |
| 77 const PostFilterOnLoadCallback& post_filter_on_load_callback, | 77 const PostFilterOnLoadCallback& post_filter_on_load_callback, |
| 78 std::unique_ptr<base::DictionaryValue> pref_store_contents) override; | 78 std::unique_ptr<base::DictionaryValue> pref_store_contents) override; |
| 79 void FilterUpdate(const std::string& path) override {} | 79 void FilterUpdate(const std::string& path) override {} |
| 80 OnWriteCallbackPair FilterSerializeData( | 80 OnWriteCallbackPair FilterSerializeData( |
| 81 base::DictionaryValue* pref_store_contents) override { | 81 base::DictionaryValue* pref_store_contents) override { |
| 82 return on_write_callback_pair_; | 82 return on_write_callback_pair_; |
| 83 } | 83 } |
| 84 void CleanupForProfileDeletion() override {} |
| 84 | 85 |
| 85 bool has_intercepted_prefs() const { return intercepted_prefs_ != NULL; } | 86 bool has_intercepted_prefs() const { return intercepted_prefs_ != NULL; } |
| 86 | 87 |
| 87 // Finalize an intercepted read, handing |intercepted_prefs_| back to its | 88 // Finalize an intercepted read, handing |intercepted_prefs_| back to its |
| 88 // JsonPrefStore. | 89 // JsonPrefStore. |
| 89 void ReleasePrefs(); | 90 void ReleasePrefs(); |
| 90 | 91 |
| 91 private: | 92 private: |
| 92 PostFilterOnLoadCallback post_filter_on_load_callback_; | 93 PostFilterOnLoadCallback post_filter_on_load_callback_; |
| 93 std::unique_ptr<base::DictionaryValue> intercepted_prefs_; | 94 std::unique_ptr<base::DictionaryValue> intercepted_prefs_; |
| (...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 file_writer->WriteNow(MakeUnique<std::string>("foo")); | 1065 file_writer->WriteNow(MakeUnique<std::string>("foo")); |
| 1065 } | 1066 } |
| 1066 RunLoop().RunUntilIdle(); | 1067 RunLoop().RunUntilIdle(); |
| 1067 EXPECT_FALSE(successful_write_reply_observer_.GetAndResetObservationState()); | 1068 EXPECT_FALSE(successful_write_reply_observer_.GetAndResetObservationState()); |
| 1068 EXPECT_TRUE(write_callback_observer_.GetAndResetPreWriteObservationState()); | 1069 EXPECT_TRUE(write_callback_observer_.GetAndResetPreWriteObservationState()); |
| 1069 EXPECT_EQ(CALLED_WITH_SUCCESS, | 1070 EXPECT_EQ(CALLED_WITH_SUCCESS, |
| 1070 write_callback_observer_.GetAndResetPostWriteObservationState()); | 1071 write_callback_observer_.GetAndResetPostWriteObservationState()); |
| 1071 } | 1072 } |
| 1072 | 1073 |
| 1073 } // namespace base | 1074 } // namespace base |
| OLD | NEW |