Add GCMChannelStatusSyncer to schedule requests and enable/disable GCM
[chromium-blink-merge.git] / chrome / browser / prefs / tracked / tracked_atomic_preference.h
blobf55b76f6d29f008b4b5e86a1e1bcd6811fc82553
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_
8 #include <string>
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 {
22 public:
23 TrackedAtomicPreference(const std::string& pref_path,
24 size_t reporting_id,
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;
36 private:
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_