OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_PREFS_TRACKED_SPLIT_PREFERENCE_H_ |
| 6 #define CHROME_BROWSER_PREFS_TRACKED_SPLIT_PREFERENCE_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "chrome/browser/prefs/tracked_preference.h" |
| 11 |
| 12 // A TrackedSplitPreference must be tracking a dictionary pref. Each top-level |
| 13 // entry in its dictionary is tracked and enforced independently. |
| 14 // Note: preferences using this strategy must be kept in sync with |
| 15 // TrackedSplitPreferences in histograms.xml. |
| 16 class TrackedSplitPreference : public TrackedPreference { |
| 17 public: |
| 18 // Constructs a TrackedSplitPreference. |pref_path| must be a dictionary pref. |
| 19 TrackedSplitPreference(const std::string& pref_path, |
| 20 size_t reporting_id, |
| 21 size_t reporting_ids_count, |
| 22 EnforcementLevel enforcement_level); |
| 23 |
| 24 // TrackedPreference implementation. |
| 25 virtual void StoreHash(const base::Value* value, |
| 26 PrefHashStore* pref_hash_store) const OVERRIDE; |
| 27 virtual void EnforceAndReport( |
| 28 PrefHashStore* pref_hash_store, |
| 29 base::DictionaryValue* pref_store_contents) const OVERRIDE; |
| 30 |
| 31 private: |
| 32 // Reports, via UMA, the |count| of split preference entry that were |
| 33 // considered invalid in a CHANGED event. |
| 34 void ReportSplitPreferenceChangedCount(size_t count) const; |
| 35 |
| 36 const std::string pref_path_; |
| 37 |
| 38 DISALLOW_COPY_AND_ASSIGN(TrackedSplitPreference); |
| 39 }; |
| 40 |
| 41 #endif // CHROME_BROWSER_PREFS_TRACKED_SPLIT_PREFERENCE_H_ |
OLD | NEW |