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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_PREFS_TRACKED_TRACKED_ATOMIC_PREFERENCE_H_
6 #define CHROME_BROWSER_PREFS_TRACKED_TRACKED_ATOMIC_PREFERENCE_H_
10 #include "base/compiler_specific.h"
11 #include "base/macros.h"
12 #include "chrome/browser/prefs/pref_hash_filter.h"
13 #include "chrome/browser/prefs/tracked/tracked_preference.h"
14 #include "chrome/browser/prefs/tracked/tracked_preference_helper.h"
16 class TrackedPreferenceValidationDelegate
;
18 // A TrackedAtomicPreference is tracked as a whole. A hash is stored for its
19 // entire value and it is entirely reset on mismatch. An optional delegate is
20 // notified of the status of the preference during enforcement.
21 class TrackedAtomicPreference
: public TrackedPreference
{
23 TrackedAtomicPreference(const std::string
& pref_path
,
25 size_t reporting_ids_count
,
26 PrefHashFilter::EnforcementLevel enforcement_level
,
27 TrackedPreferenceValidationDelegate
* delegate
);
29 // TrackedPreference implementation.
30 virtual void OnNewValue(const base::Value
* value
,
31 PrefHashStoreTransaction
* transaction
) const OVERRIDE
;
32 virtual bool EnforceAndReport(
33 base::DictionaryValue
* pref_store_contents
,
34 PrefHashStoreTransaction
* transaction
) const OVERRIDE
;
37 const std::string pref_path_
;
38 const TrackedPreferenceHelper helper_
;
39 TrackedPreferenceValidationDelegate
* delegate_
;
41 DISALLOW_COPY_AND_ASSIGN(TrackedAtomicPreference
);
44 #endif // CHROME_BROWSER_PREFS_TRACKED_TRACKED_ATOMIC_PREFERENCE_H_