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

Side by Side Diff: services/preferences/tracked/tracked_split_preference.h

Issue 2782803002: Move tracked prefs into services/preferences/tracked. (Closed)
Patch Set: rebase Created 3 years, 8 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 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 COMPONENTS_USER_PREFS_TRACKED_TRACKED_SPLIT_PREFERENCE_H_ 5 #ifndef SERVICES_PREFERENCES_TRACKED_TRACKED_SPLIT_PREFERENCE_H_
6 #define COMPONENTS_USER_PREFS_TRACKED_TRACKED_SPLIT_PREFERENCE_H_ 6 #define SERVICES_PREFERENCES_TRACKED_TRACKED_SPLIT_PREFERENCE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "components/user_prefs/tracked/pref_hash_filter.h" 14 #include "services/preferences/tracked/pref_hash_filter.h"
15 #include "components/user_prefs/tracked/tracked_preference.h" 15 #include "services/preferences/tracked/tracked_preference.h"
16 #include "components/user_prefs/tracked/tracked_preference_helper.h" 16 #include "services/preferences/tracked/tracked_preference_helper.h"
17 17
18 namespace prefs { 18 namespace prefs {
19 namespace mojom { 19 namespace mojom {
20 class TrackedPreferenceValidationDelegate; 20 class TrackedPreferenceValidationDelegate;
21 } 21 }
22 } 22 }
23 23
24 // A TrackedSplitPreference must be tracking a dictionary pref. Each top-level 24 // A TrackedSplitPreference must be tracking a dictionary pref. Each top-level
25 // entry in its dictionary is tracked and enforced independently. An optional 25 // entry in its dictionary is tracked and enforced independently. An optional
26 // delegate is notified of the status of the preference during enforcement. 26 // delegate is notified of the status of the preference during enforcement.
27 // Note: preferences using this strategy must be kept in sync with 27 // Note: preferences using this strategy must be kept in sync with
28 // TrackedSplitPreferences in histograms.xml. 28 // TrackedSplitPreferences in histograms.xml.
29 class TrackedSplitPreference : public TrackedPreference { 29 class TrackedSplitPreference : public TrackedPreference {
30 public: 30 public:
31 // Constructs a TrackedSplitPreference. |pref_path| must be a dictionary pref. 31 // Constructs a TrackedSplitPreference. |pref_path| must be a dictionary pref.
32 TrackedSplitPreference( 32 TrackedSplitPreference(
33 const std::string& pref_path, 33 const std::string& pref_path,
34 size_t reporting_id, 34 size_t reporting_id,
35 size_t reporting_ids_count, 35 size_t reporting_ids_count,
36 PrefHashFilter::EnforcementLevel enforcement_level, 36 prefs::mojom::TrackedPreferenceMetadata::EnforcementLevel
37 PrefHashFilter::ValueType value_type, 37 enforcement_level,
38 prefs::mojom::TrackedPreferenceMetadata::ValueType value_type,
38 prefs::mojom::TrackedPreferenceValidationDelegate* delegate); 39 prefs::mojom::TrackedPreferenceValidationDelegate* delegate);
39 40
40 // TrackedPreference implementation. 41 // TrackedPreference implementation.
41 TrackedPreferenceType GetType() const override; 42 TrackedPreferenceType GetType() const override;
42 void OnNewValue(const base::Value* value, 43 void OnNewValue(const base::Value* value,
43 PrefHashStoreTransaction* transaction) const override; 44 PrefHashStoreTransaction* transaction) const override;
44 bool EnforceAndReport( 45 bool EnforceAndReport(
45 base::DictionaryValue* pref_store_contents, 46 base::DictionaryValue* pref_store_contents,
46 PrefHashStoreTransaction* transaction, 47 PrefHashStoreTransaction* transaction,
47 PrefHashStoreTransaction* external_validation_transaction) const override; 48 PrefHashStoreTransaction* external_validation_transaction) const override;
48 49
49 private: 50 private:
50 const std::string pref_path_; 51 const std::string pref_path_;
51 const TrackedPreferenceHelper helper_; 52 const TrackedPreferenceHelper helper_;
52 prefs::mojom::TrackedPreferenceValidationDelegate* delegate_; 53 prefs::mojom::TrackedPreferenceValidationDelegate* delegate_;
53 54
54 DISALLOW_COPY_AND_ASSIGN(TrackedSplitPreference); 55 DISALLOW_COPY_AND_ASSIGN(TrackedSplitPreference);
55 }; 56 };
56 57
57 #endif // COMPONENTS_USER_PREFS_TRACKED_TRACKED_SPLIT_PREFERENCE_H_ 58 #endif // SERVICES_PREFERENCES_TRACKED_TRACKED_SPLIT_PREFERENCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698