#include "components/supervised_user/core/browser/child_account_service.h"
#include <functional>
#include <utility>
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/metrics/field_trial.h"
#include "base/no_destructor.h"
#include "base/values.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "components/policy/core/common/policy_pref_names.h"
#include "components/signin/public/base/consent_level.h"
#include "components/signin/public/base/signin_switches.h"
#include "components/signin/public/identity_manager/account_info.h"
#include "components/signin/public/identity_manager/accounts_in_cookie_jar_info.h"
#include "components/signin/public/identity_manager/tribool.h"
#include "components/supervised_user/core/browser/list_family_members_service.h"
#include "components/supervised_user/core/browser/proto/families_common.pb.h"
#include "components/supervised_user/core/browser/proto_fetcher.h"
#include "components/supervised_user/core/browser/supervised_user_capabilities.h"
#include "components/supervised_user/core/browser/supervised_user_preferences.h"
#include "components/supervised_user/core/browser/supervised_user_settings_service.h"
#include "components/supervised_user/core/common/features.h"
#include "components/supervised_user/core/common/pref_names.h"
#include "components/supervised_user/core/common/supervised_user_constants.h"
namespace supervised_user {
namespace {
BindRepeating;
}
ChildAccountService::ChildAccountService(
PrefService& user_prefs,
signin::IdentityManager* identity_manager,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
base::OnceCallback<void(bool)> check_user_child_status_callback,
ListFamilyMembersService& list_family_members_service)
: … { … }
ChildAccountService::~ChildAccountService() = default;
void ChildAccountService::Init() { … }
void ChildAccountService::Shutdown() { … }
#if BUILDFLAG(IS_CHROMEOS)
bool ChildAccountService::IsChildAccountStatusKnown() {
return supervised_user::IsChildAccountStatusKnown(user_prefs_.get());
}
void ChildAccountService::AddChildStatusReceivedCallback(
base::OnceClosure callback) {
if (supervised_user::IsChildAccountStatusKnown(user_prefs_.get())) {
std::move(callback).Run();
} else {
status_received_callback_list_.push_back(std::move(callback));
}
}
#endif
ChildAccountService::AuthState ChildAccountService::GetGoogleAuthState() { … }
base::CallbackListSubscription ChildAccountService::ObserveGoogleAuthState(
const base::RepeatingCallback<void()>& callback) { … }
void ChildAccountService::SetSupervisionStatusAndNotifyObservers(
bool supervision_status) { … }
void ChildAccountService::OnPrimaryAccountChanged(
const signin::PrimaryAccountChangeEvent& event_details) { … }
void ChildAccountService::UpdateForceGoogleSafeSearch() { … }
void ChildAccountService::OnExtendedAccountInfoUpdated(
const AccountInfo& info) { … }
void ChildAccountService::OnAccountsInCookieUpdated(
const signin::AccountsInCookieJarInfo& accounts_in_cookie_jar_info,
const GoogleServiceAuthError& error) { … }
}