| Index: chrome/browser/supervised_user/child_accounts/child_account_service.cc
|
| diff --git a/chrome/browser/supervised_user/child_accounts/child_account_service.cc b/chrome/browser/supervised_user/child_accounts/child_account_service.cc
|
| index a523f6268170932b52aaea71fba2feaf8ac5676d..64cf0c117452722d4d6f9ca29937ccc211f70db4 100644
|
| --- a/chrome/browser/supervised_user/child_accounts/child_account_service.cc
|
| +++ b/chrome/browser/supervised_user/child_accounts/child_account_service.cc
|
| @@ -27,6 +27,11 @@
|
| #include "components/signin/core/browser/profile_oauth2_token_service.h"
|
| #include "components/signin/core/browser/signin_manager.h"
|
|
|
| +#if defined(OS_ANDROID)
|
| +#include "base/android/jni_android.h"
|
| +#include "chrome/browser/supervised_user/child_accounts/child_account_service_android.h"
|
| +#endif
|
| +
|
| #if defined(OS_CHROMEOS)
|
| #include "chrome/browser/chromeos/profiles/profile_helper.h"
|
| #include "components/user_manager/user_manager.h"
|
| @@ -95,9 +100,35 @@
|
| registry->RegisterBooleanPref(prefs::kChildAccountStatusKnown, false);
|
| }
|
|
|
| +void ChildAccountService::SetIsChildAccount(bool is_child_account) {
|
| + PropagateChildStatusToUser(is_child_account);
|
| + if (profile_->IsChild() != is_child_account) {
|
| + if (is_child_account) {
|
| + profile_->GetPrefs()->SetString(prefs::kSupervisedUserId,
|
| + supervised_users::kChildAccountSUID);
|
| + } else {
|
| + profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserId);
|
| +
|
| + ClearFirstCustodianPrefs();
|
| + ClearSecondCustodianPrefs();
|
| + }
|
| + }
|
| + profile_->GetPrefs()->SetBoolean(prefs::kChildAccountStatusKnown, true);
|
| +
|
| + for (const auto& callback : status_received_callback_list_)
|
| + callback.Run();
|
| + status_received_callback_list_.clear();
|
| +}
|
| +
|
| void ChildAccountService::Init() {
|
| SupervisedUserServiceFactory::GetForProfile(profile_)->SetDelegate(this);
|
| AccountTrackerServiceFactory::GetForProfile(profile_)->AddObserver(this);
|
| +
|
| +#if defined(OS_ANDROID)
|
| + bool is_child_account = false;
|
| + if (GetJavaChildAccountStatus(&is_child_account))
|
| + SetIsChildAccount(is_child_account);
|
| +#endif
|
|
|
| PropagateChildStatusToUser(profile_->IsChild());
|
|
|
| @@ -179,26 +210,6 @@
|
| sync_service->ReconfigureDatatypeManager();
|
|
|
| return true;
|
| -}
|
| -
|
| -void ChildAccountService::SetIsChildAccount(bool is_child_account) {
|
| - PropagateChildStatusToUser(is_child_account);
|
| - if (profile_->IsChild() != is_child_account) {
|
| - if (is_child_account) {
|
| - profile_->GetPrefs()->SetString(prefs::kSupervisedUserId,
|
| - supervised_users::kChildAccountSUID);
|
| - } else {
|
| - profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserId);
|
| -
|
| - ClearFirstCustodianPrefs();
|
| - ClearSecondCustodianPrefs();
|
| - }
|
| - }
|
| - profile_->GetPrefs()->SetBoolean(prefs::kChildAccountStatusKnown, true);
|
| -
|
| - for (const auto& callback : status_received_callback_list_)
|
| - callback.Run();
|
| - status_received_callback_list_.clear();
|
| }
|
|
|
| void ChildAccountService::OnAccountUpdated(const AccountInfo& info) {
|
|
|