#include "chrome/browser/prefs/profile_pref_store_manager.h"
#include <utility>
#include "base/check.h"
#include "base/files/file_util.h"
#include "base/json/json_file_value_serializer.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_util.h"
#include "base/task/sequenced_task_runner.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/prefs/browser_prefs.h"
#include "chrome/common/chrome_constants.h"
#include "components/prefs/json_pref_store.h"
#include "components/prefs/persistent_pref_store.h"
#include "components/prefs/pref_registry_simple.h"
#include "services/preferences/public/mojom/preferences.mojom.h"
#include "services/preferences/tracked/pref_hash_filter.h"
#include "services/preferences/tracked/tracked_persistent_pref_store_factory.h"
#if BUILDFLAG(IS_WIN)
#include "chrome/install_static/install_util.h"
#endif
namespace {
#if BUILDFLAG(IS_WIN)
const std::wstring* g_preference_validation_registry_path_for_testing = nullptr;
#endif
}
const bool ProfilePrefStoreManager::kPlatformSupportsPreferenceTracking = …false;
#else
true;
#endif
ProfilePrefStoreManager::ProfilePrefStoreManager(
const base::FilePath& profile_path,
const std::string& seed,
const std::string& legacy_device_id)
: … { … }
ProfilePrefStoreManager::~ProfilePrefStoreManager() = default;
void ProfilePrefStoreManager::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) { … }
base::Time ProfilePrefStoreManager::GetResetTime(PrefService* pref_service) { … }
void ProfilePrefStoreManager::ClearResetTime(PrefService* pref_service) { … }
#if BUILDFLAG(IS_WIN)
void ProfilePrefStoreManager::SetPreferenceValidationRegistryPathForTesting(
const std::wstring* path) {
DCHECK(!path->empty());
g_preference_validation_registry_path_for_testing = path;
}
#endif
PersistentPrefStore* ProfilePrefStoreManager::CreateProfilePrefStore(
std::vector<prefs::mojom::TrackedPreferenceMetadataPtr>
tracking_configuration,
size_t reporting_ids_count,
scoped_refptr<base::SequencedTaskRunner> io_task_runner,
mojo::PendingRemote<prefs::mojom::ResetOnLoadObserver>
reset_on_load_observer,
mojo::PendingRemote<prefs::mojom::TrackedPreferenceValidationDelegate>
validation_delegate) { … }
bool ProfilePrefStoreManager::InitializePrefsFromMasterPrefs(
std::vector<prefs::mojom::TrackedPreferenceMetadataPtr>
tracking_configuration,
size_t reporting_ids_count,
base::Value::Dict master_prefs) { … }
prefs::mojom::TrackedPersistentPrefStoreConfigurationPtr
ProfilePrefStoreManager::CreateTrackedPrefStoreConfiguration(
std::vector<prefs::mojom::TrackedPreferenceMetadataPtr>
tracking_configuration,
size_t reporting_ids_count,
mojo::PendingRemote<prefs::mojom::ResetOnLoadObserver>
reset_on_load_observer,
mojo::PendingRemote<prefs::mojom::TrackedPreferenceValidationDelegate>
validation_delegate) { … }