#include "components/sync_preferences/pref_service_syncable.h"
#include <utility>
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/observer_list.h"
#include "base/scoped_observation.h"
#include "build/chromeos_buildflags.h"
#include "components/metrics/demographics/user_demographics.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/in_memory_pref_store.h"
#include "components/prefs/overlay_user_pref_store.h"
#include "components/prefs/pref_notifier_impl.h"
#include "components/prefs/pref_registry.h"
#include "components/prefs/pref_value_store.h"
#include "components/sync/base/features.h"
#include "components/sync/service/sync_service.h"
#include "components/sync_preferences/dual_layer_user_pref_store.h"
#include "components/sync_preferences/pref_model_associator.h"
#include "components/sync_preferences/pref_service_syncable_observer.h"
#include "components/sync_preferences/synced_pref_observer.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/constants/ash_features.h"
#endif
namespace sync_preferences {
class PrefServiceSyncable::DemographicsPrefsClearer
: public syncer::SyncServiceObserver { … };
PrefServiceSyncable::PrefServiceSyncable(
std::unique_ptr<PrefNotifierImpl> pref_notifier,
std::unique_ptr<PrefValueStore> pref_value_store,
scoped_refptr<PersistentPrefStore> user_prefs,
scoped_refptr<PersistentPrefStore> standalone_browser_prefs,
scoped_refptr<user_prefs::PrefRegistrySyncable> pref_registry,
scoped_refptr<PrefModelAssociatorClient> pref_model_associator_client,
base::RepeatingCallback<void(PersistentPrefStore::PrefReadError)>
read_error_callback,
bool async)
: … { … }
PrefServiceSyncable::PrefServiceSyncable(
std::unique_ptr<PrefNotifierImpl> pref_notifier,
std::unique_ptr<PrefValueStore> pref_value_store,
scoped_refptr<DualLayerUserPrefStore> dual_layer_user_prefs,
scoped_refptr<PersistentPrefStore> standalone_browser_prefs,
scoped_refptr<user_prefs::PrefRegistrySyncable> pref_registry,
scoped_refptr<PrefModelAssociatorClient> pref_model_associator_client,
base::RepeatingCallback<void(PersistentPrefStore::PrefReadError)>
read_error_callback,
bool async)
: … { … }
void PrefServiceSyncable::ConnectAssociatorsAndRegisterPreferences() { … }
PrefServiceSyncable::~PrefServiceSyncable() { … }
std::unique_ptr<PrefServiceSyncable>
PrefServiceSyncable::CreateIncognitoPrefService(
PrefStore* incognito_extension_pref_store,
const std::vector<const char*>& persistent_pref_names) { … }
bool PrefServiceSyncable::IsSyncing() { … }
bool PrefServiceSyncable::IsPrioritySyncing() { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
bool PrefServiceSyncable::AreOsPrefsSyncing() {
return os_pref_sync_associator_.models_associated();
}
bool PrefServiceSyncable::AreOsPriorityPrefsSyncing() {
return os_priority_pref_sync_associator_.models_associated();
}
#endif
void PrefServiceSyncable::AddObserver(PrefServiceSyncableObserver* observer) { … }
void PrefServiceSyncable::RemoveObserver(
PrefServiceSyncableObserver* observer) { … }
syncer::SyncableService* PrefServiceSyncable::GetSyncableService(
const syncer::DataType& type) { … }
void PrefServiceSyncable::UpdateCommandLinePrefStore(
PrefStore* cmd_line_store) { … }
void PrefServiceSyncable::AddSyncedPrefObserver(const std::string& name,
SyncedPrefObserver* observer) { … }
void PrefServiceSyncable::RemoveSyncedPrefObserver(
const std::string& name,
SyncedPrefObserver* observer) { … }
void PrefServiceSyncable::AddRegisteredSyncablePreference(std::string_view path,
uint32_t flags) { … }
base::Value::Type PrefServiceSyncable::GetRegisteredPrefType(
std::string_view pref_name) const { … }
void PrefServiceSyncable::OnIsSyncingChanged() { … }
uint32_t PrefServiceSyncable::GetWriteFlags(std::string_view pref_name) const { … }
void PrefServiceSyncable::OnSyncServiceInitialized(
syncer::SyncService* sync_service) { … }
}