Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: components/user_prefs/tracked/pref_hash_filter.h

Issue 2719833002: Convert TrackedPreferenceValidationDelegate into a mojo interface. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_USER_PREFS_TRACKED_PREF_HASH_FILTER_H_ 5 #ifndef COMPONENTS_USER_PREFS_TRACKED_PREF_HASH_FILTER_H_
6 #define COMPONENTS_USER_PREFS_TRACKED_PREF_HASH_FILTER_H_ 6 #define COMPONENTS_USER_PREFS_TRACKED_PREF_HASH_FILTER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
11 #include <memory> 11 #include <memory>
12 #include <set> 12 #include <set>
13 #include <unordered_map> 13 #include <unordered_map>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/callback.h" 16 #include "base/callback.h"
17 #include "base/compiler_specific.h" 17 #include "base/compiler_specific.h"
18 #include "base/files/file_path.h" 18 #include "base/files/file_path.h"
19 #include "base/macros.h" 19 #include "base/macros.h"
20 #include "base/optional.h" 20 #include "base/optional.h"
21 #include "components/user_prefs/tracked/hash_store_contents.h" 21 #include "components/user_prefs/tracked/hash_store_contents.h"
22 #include "components/user_prefs/tracked/interceptable_pref_filter.h" 22 #include "components/user_prefs/tracked/interceptable_pref_filter.h"
23 #include "components/user_prefs/tracked/tracked_preference.h" 23 #include "components/user_prefs/tracked/tracked_preference.h"
24 24
25 class PrefHashStore; 25 class PrefHashStore;
26 class PrefService; 26 class PrefService;
27 class TrackedPreferenceValidationDelegate;
28 27
29 namespace base { 28 namespace base {
30 class DictionaryValue; 29 class DictionaryValue;
31 class Time; 30 class Time;
32 } // namespace base 31 } // namespace base
33 32
33 namespace prefs {
34 namespace mojom {
35 class TrackedPreferenceValidationDelegate;
36 }
37 }
38
34 namespace user_prefs { 39 namespace user_prefs {
35 class PrefRegistrySyncable; 40 class PrefRegistrySyncable;
36 } // namespace user_prefs 41 } // namespace user_prefs
37 42
38 // Intercepts preference values as they are loaded from disk and verifies them 43 // Intercepts preference values as they are loaded from disk and verifies them
39 // using a PrefHashStore. Keeps the PrefHashStore contents up to date as values 44 // using a PrefHashStore. Keeps the PrefHashStore contents up to date as values
40 // are changed. 45 // are changed.
41 class PrefHashFilter : public InterceptablePrefFilter { 46 class PrefHashFilter : public InterceptablePrefFilter {
42 public: 47 public:
43 enum EnforcementLevel { NO_ENFORCEMENT, ENFORCE_ON_LOAD }; 48 enum EnforcementLevel { NO_ENFORCEMENT, ENFORCE_ON_LOAD };
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // than |tracked_preferences.size()|). If |report_super_mac_validity| is true, 82 // than |tracked_preferences.size()|). If |report_super_mac_validity| is true,
78 // the state of the super MAC will be reported via UMA during 83 // the state of the super MAC will be reported via UMA during
79 // FinalizeFilterOnLoad. 84 // FinalizeFilterOnLoad.
80 // |external_validation_hash_store_pair_| will be used (if non-null) to 85 // |external_validation_hash_store_pair_| will be used (if non-null) to
81 // perform extra validations without triggering resets. 86 // perform extra validations without triggering resets.
82 PrefHashFilter( 87 PrefHashFilter(
83 std::unique_ptr<PrefHashStore> pref_hash_store, 88 std::unique_ptr<PrefHashStore> pref_hash_store,
84 StoreContentsPair external_validation_hash_store_pair_, 89 StoreContentsPair external_validation_hash_store_pair_,
85 const std::vector<TrackedPreferenceMetadata>& tracked_preferences, 90 const std::vector<TrackedPreferenceMetadata>& tracked_preferences,
86 const base::Closure& on_reset_on_load, 91 const base::Closure& on_reset_on_load,
87 TrackedPreferenceValidationDelegate* delegate, 92 prefs::mojom::TrackedPreferenceValidationDelegate* delegate,
88 size_t reporting_ids_count, 93 size_t reporting_ids_count,
89 bool report_super_mac_validity); 94 bool report_super_mac_validity);
90 95
91 ~PrefHashFilter() override; 96 ~PrefHashFilter() override;
92 97
93 // Registers required user preferences. 98 // Registers required user preferences.
94 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 99 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
95 100
96 // Retrieves the time of the last reset event, if any, for the provided user 101 // Retrieves the time of the last reset event, if any, for the provided user
97 // preferences. If no reset has occurred, Returns a null |Time|. 102 // preferences. If no reset has occurred, Returns a null |Time|.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 // FilterSerializeData. 172 // FilterSerializeData.
168 ChangedPathsMap changed_paths_; 173 ChangedPathsMap changed_paths_;
169 174
170 // Whether to report the validity of the super MAC at load time (via UMA). 175 // Whether to report the validity of the super MAC at load time (via UMA).
171 bool report_super_mac_validity_; 176 bool report_super_mac_validity_;
172 177
173 DISALLOW_COPY_AND_ASSIGN(PrefHashFilter); 178 DISALLOW_COPY_AND_ASSIGN(PrefHashFilter);
174 }; 179 };
175 180
176 #endif // COMPONENTS_PREFS_TRACKED_PREF_HASH_FILTER_H_ 181 #endif // COMPONENTS_PREFS_TRACKED_PREF_HASH_FILTER_H_
OLDNEW
« no previous file with comments | « components/user_prefs/tracked/mock_validation_delegate.cc ('k') | components/user_prefs/tracked/pref_hash_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698