#include "services/preferences/tracked/pref_hash_filter.h"
#include <stdint.h>
#include <algorithm>
#include <memory>
#include <utility>
#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
#include "base/strings/string_number_conversions.h"
#include "base/time/time.h"
#include "base/values.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/pref_store.h"
#include "services/preferences/public/cpp/tracked/pref_names.h"
#include "services/preferences/tracked/dictionary_hash_store_contents.h"
#include "services/preferences/tracked/pref_hash_store_transaction.h"
#include "services/preferences/tracked/tracked_atomic_preference.h"
#include "services/preferences/tracked/tracked_split_preference.h"
namespace {
std::vector<const char*>* GetDeprecatedPrefs() { … }
void CleanupDeprecatedTrackedPreferences(
base::Value::Dict& pref_store_contents,
PrefHashStoreTransaction* hash_store_transaction) { … }
}
PrefTrackingStrategy;
PrefHashFilter::PrefHashFilter(
std::unique_ptr<PrefHashStore> pref_hash_store,
StoreContentsPair external_validation_hash_store_pair,
const std::vector<prefs::mojom::TrackedPreferenceMetadataPtr>&
tracked_preferences,
mojo::PendingRemote<prefs::mojom::ResetOnLoadObserver>
reset_on_load_observer,
scoped_refptr<base::RefCountedData<
mojo::Remote<prefs::mojom::TrackedPreferenceValidationDelegate>>>
delegate,
size_t reporting_ids_count)
: … { … }
PrefHashFilter::~PrefHashFilter() { … }
void PrefHashFilter::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) { … }
base::Time PrefHashFilter::GetResetTime(PrefService* user_prefs) { … }
void PrefHashFilter::ClearResetTime(PrefService* user_prefs) { … }
void PrefHashFilter::Initialize(base::Value::Dict& pref_store_contents) { … }
void PrefHashFilter::FilterUpdate(std::string_view path) { … }
PrefFilter::OnWriteCallbackPair PrefHashFilter::FilterSerializeData(
base::Value::Dict& pref_store_contents) { … }
void PrefHashFilter::OnStoreDeletionFromDisk() { … }
void PrefHashFilter::FinalizeFilterOnLoad(
PostFilterOnLoadCallback post_filter_on_load_callback,
base::Value::Dict pref_store_contents,
bool prefs_altered) { … }
base::WeakPtr<InterceptablePrefFilter> PrefHashFilter::AsWeakPtr() { … }
void PrefHashFilter::ClearFromExternalStore(
HashStoreContents* external_validation_hash_store_contents,
const base::Value::Dict* changed_paths_and_macs) { … }
void PrefHashFilter::FlushToExternalStore(
std::unique_ptr<HashStoreContents> external_validation_hash_store_contents,
std::unique_ptr<base::Value::Dict> changed_paths_and_macs,
bool write_success) { … }
PrefFilter::OnWriteCallbackPair PrefHashFilter::GetOnWriteSynchronousCallbacks(
base::Value::Dict& pref_store_contents) { … }
void PrefHashFilter::SetDeprecatedPrefsForTesting(
const std::vector<const char*>& deprecated_prefs) { … }