OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROME_BROWSER_PREFS_TRACKED_INTERCEPTABLE_PREF_FILTER_H_ | 5 #ifndef CHROME_BROWSER_PREFS_TRACKED_INTERCEPTABLE_PREF_FILTER_H_ |
6 #define CHROME_BROWSER_PREFS_TRACKED_INTERCEPTABLE_PREF_FILTER_H_ | 6 #define CHROME_BROWSER_PREFS_TRACKED_INTERCEPTABLE_PREF_FILTER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/prefs/pref_filter.h" | 10 #include "base/prefs/pref_filter.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 typedef base::Callback< | 31 typedef base::Callback< |
32 void(const FinalizeFilterOnLoadCallback& finalize_filter_on_load, | 32 void(const FinalizeFilterOnLoadCallback& finalize_filter_on_load, |
33 scoped_ptr<base::DictionaryValue> prefs)> FilterOnLoadInterceptor; | 33 scoped_ptr<base::DictionaryValue> prefs)> FilterOnLoadInterceptor; |
34 | 34 |
35 InterceptablePrefFilter(); | 35 InterceptablePrefFilter(); |
36 virtual ~InterceptablePrefFilter(); | 36 virtual ~InterceptablePrefFilter(); |
37 | 37 |
38 // PrefFilter partial implementation. | 38 // PrefFilter partial implementation. |
39 virtual void FilterOnLoad( | 39 virtual void FilterOnLoad( |
40 const PostFilterOnLoadCallback& post_filter_on_load_callback, | 40 const PostFilterOnLoadCallback& post_filter_on_load_callback, |
41 scoped_ptr<base::DictionaryValue> pref_store_contents) OVERRIDE; | 41 scoped_ptr<base::DictionaryValue> pref_store_contents) override; |
42 | 42 |
43 // Registers |filter_on_load_interceptor| to intercept the next FilterOnLoad | 43 // Registers |filter_on_load_interceptor| to intercept the next FilterOnLoad |
44 // event. At most one FilterOnLoadInterceptor should be registered per | 44 // event. At most one FilterOnLoadInterceptor should be registered per |
45 // PrefFilter. | 45 // PrefFilter. |
46 void InterceptNextFilterOnLoad( | 46 void InterceptNextFilterOnLoad( |
47 const FilterOnLoadInterceptor& filter_on_load_interceptor); | 47 const FilterOnLoadInterceptor& filter_on_load_interceptor); |
48 | 48 |
49 private: | 49 private: |
50 // Does any extra filtering required by the implementation of this | 50 // Does any extra filtering required by the implementation of this |
51 // InterceptablePrefFilter and hands back the |pref_store_contents| to the | 51 // InterceptablePrefFilter and hands back the |pref_store_contents| to the |
52 // initial caller of FilterOnLoad. | 52 // initial caller of FilterOnLoad. |
53 virtual void FinalizeFilterOnLoad( | 53 virtual void FinalizeFilterOnLoad( |
54 const PostFilterOnLoadCallback& post_filter_on_load_callback, | 54 const PostFilterOnLoadCallback& post_filter_on_load_callback, |
55 scoped_ptr<base::DictionaryValue> pref_store_contents, | 55 scoped_ptr<base::DictionaryValue> pref_store_contents, |
56 bool prefs_altered) = 0; | 56 bool prefs_altered) = 0; |
57 | 57 |
58 // Callback to be invoked only once (and subsequently reset) on the next | 58 // Callback to be invoked only once (and subsequently reset) on the next |
59 // FilterOnLoad event. It will be allowed to modify the |prefs| handed to | 59 // FilterOnLoad event. It will be allowed to modify the |prefs| handed to |
60 // FilterOnLoad before handing them back to this PrefHashFilter. | 60 // FilterOnLoad before handing them back to this PrefHashFilter. |
61 FilterOnLoadInterceptor filter_on_load_interceptor_; | 61 FilterOnLoadInterceptor filter_on_load_interceptor_; |
62 }; | 62 }; |
63 | 63 |
64 #endif // CHROME_BROWSER_PREFS_TRACKED_INTERCEPTABLE_PREF_FILTER_H_ | 64 #endif // CHROME_BROWSER_PREFS_TRACKED_INTERCEPTABLE_PREF_FILTER_H_ |
OLD | NEW |