Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3086)

Unified Diff: chrome/browser/supervised_user/child_accounts/child_account_service.cc

Issue 1051273009: Correct ChildAccountService child flag retrieval (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add const. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cbc080fb3b2d9f20ca06eed462f43a326484b0f4..ab5868f665357efb3dfb88ae110ca8c3637ee898 100644
--- a/chrome/browser/supervised_user/child_accounts/child_account_service.cc
+++ b/chrome/browser/supervised_user/child_accounts/child_account_service.cc
@@ -103,15 +103,19 @@ void ChildAccountService::RegisterProfilePrefs(
void ChildAccountService::SetIsChildAccount(bool is_child_account) {
PropagateChildStatusToUser(is_child_account);
- if (profile_->IsChild() == is_child_account)
- return;
-
- if (is_child_account) {
- profile_->GetPrefs()->SetString(prefs::kSupervisedUserId,
- supervised_users::kChildAccountSUID);
- } else {
- profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserId);
+ if (profile_->IsChild() != is_child_account) {
+ if (is_child_account) {
+ profile_->GetPrefs()->SetString(prefs::kSupervisedUserId,
+ supervised_users::kChildAccountSUID);
+ } else {
+ profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserId);
+ }
}
+ profile_->GetPrefs()->SetBoolean(prefs::kChildAccountStatusKnown, true);
+
+ for (const auto& callback : status_received_callback_list_)
+ callback.Run();
+ status_received_callback_list_.clear();
}
void ChildAccountService::Init() {
@@ -321,16 +325,6 @@ void ChildAccountService::OnFlagsFetched(
std::find(flags.begin(), flags.end(),
kIsChildAccountServiceFlagName) != flags.end();
- bool status_was_known = profile_->GetPrefs()->GetBoolean(
- prefs::kChildAccountStatusKnown);
- profile_->GetPrefs()->SetBoolean(prefs::kChildAccountStatusKnown, true);
-
- if (!status_was_known) {
- for (auto& callback : status_received_callback_list_)
- callback.Run();
- status_received_callback_list_.clear();
- }
-
SetIsChildAccount(is_child_account);
ScheduleNextStatusFlagUpdate(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698