#include "components/supervised_user/core/browser/supervised_user_settings_service.h"
#include <stddef.h>
#include <set>
#include <string_view>
#include <utility>
#include "base/feature_list.h"
#include "base/functional/callback.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/user_metrics.h"
#include "base/strings/string_util.h"
#include "base/task/sequenced_task_runner.h"
#include "base/values.h"
#include "components/prefs/json_pref_store.h"
#include "components/prefs/pref_filter.h"
#include "components/supervised_user/core/common/supervised_user_constants.h"
#include "components/sync/model/sync_change.h"
#include "components/sync/model/sync_change_processor.h"
#include "components/sync/protocol/entity_specifics.pb.h"
#include "components/sync/protocol/managed_user_setting_specifics.pb.h"
namespace supervised_user {
JSONReader;
UserMetricsAction;
Value;
DataType;
ModelError;
SUPERVISED_USER_SETTINGS;
SyncChange;
SyncChangeList;
SyncChangeProcessor;
SyncData;
SyncDataList;
const char kAtomicSettings[] = …;
const char kSupervisedUserInternalItemPrefix[] = …;
const char kQueuedItems[] = …;
const char kSplitSettingKeySeparator = …;
const char kSplitSettings[] = …;
namespace {
bool SettingShouldApplyToPrefs(const std::string& name) { … }
bool SyncChangeIsNewWebsiteApproval(const std::string& name,
SyncChange::SyncChangeType change_type,
base::Value* old_value,
base::Value* new_value) { … }
}
SupervisedUserSettingsService::SupervisedUserSettingsService()
: … { … }
SupervisedUserSettingsService::~SupervisedUserSettingsService() { … }
void SupervisedUserSettingsService::Init(
base::FilePath profile_path,
scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner,
bool load_synchronously) { … }
void SupervisedUserSettingsService::Init(
scoped_refptr<PersistentPrefStore> store) { … }
base::CallbackListSubscription
SupervisedUserSettingsService::SubscribeForSettingsChange(
const SettingsCallback& callback) { … }
base::CallbackListSubscription
SupervisedUserSettingsService::SubscribeForNewWebsiteApproval(
const WebsiteApprovalCallback& callback) { … }
void SupervisedUserSettingsService::RecordLocalWebsiteApproval(
const std::string& host) { … }
base::CallbackListSubscription
SupervisedUserSettingsService::SubscribeForShutdown(
const ShutdownCallback& callback) { … }
bool SupervisedUserSettingsService::IsCustomPassphraseAllowed() const { … }
void SupervisedUserSettingsService::SetActive(bool active) { … }
bool SupervisedUserSettingsService::IsReady() const { … }
void SupervisedUserSettingsService::Clear() { … }
std::string SupervisedUserSettingsService::MakeSplitSettingKey(
const std::string& prefix,
const std::string& key) { … }
void SupervisedUserSettingsService::SaveItem(
const std::string& key,
base::Value value) { … }
void SupervisedUserSettingsService::SetLocalSetting(std::string_view key,
base::Value value) { … }
void SupervisedUserSettingsService::SetLocalSetting(std::string_view key,
base::Value::Dict dict) { … }
void SupervisedUserSettingsService::RemoveLocalSetting(std::string_view key) { … }
SyncData SupervisedUserSettingsService::CreateSyncDataForSetting(
const std::string& name,
const base::Value& value) { … }
void SupervisedUserSettingsService::Shutdown() { … }
void SupervisedUserSettingsService::WaitUntilReadyToSync(
base::OnceClosure done) { … }
std::optional<syncer::ModelError>
SupervisedUserSettingsService::MergeDataAndStartSyncing(
DataType type,
const SyncDataList& initial_sync_data,
std::unique_ptr<SyncChangeProcessor> sync_processor) { … }
void SupervisedUserSettingsService::StopSyncing(DataType type) { … }
SyncDataList SupervisedUserSettingsService::GetAllSyncDataForTesting(
DataType type) const { … }
std::optional<syncer::ModelError>
SupervisedUserSettingsService::ProcessSyncChanges(
const base::Location& from_here,
const SyncChangeList& change_list) { … }
base::WeakPtr<syncer::SyncableService>
SupervisedUserSettingsService::AsWeakPtr() { … }
void SupervisedUserSettingsService::OnInitializationCompleted(bool success) { … }
const base::Value::Dict& SupervisedUserSettingsService::LocalSettingsForTest()
const { … }
base::Value::Dict* SupervisedUserSettingsService::GetDictionaryAndSplitKey(
std::string* key) const { … }
base::Value::Dict* SupervisedUserSettingsService::GetOrCreateDictionary(
const std::string& key) const { … }
base::Value::Dict* SupervisedUserSettingsService::GetAtomicSettings() const { … }
base::Value::Dict* SupervisedUserSettingsService::GetSplitSettings() const { … }
base::Value::Dict* SupervisedUserSettingsService::GetQueuedItems() const { … }
base::Value::Dict SupervisedUserSettingsService::GetSettingsWithDefault() { … }
void SupervisedUserSettingsService::InformSubscribers() { … }
}