OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/supervised_user/child_accounts/child_account_service.h" | 5 #include "chrome/browser/supervised_user/child_accounts/child_account_service.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 void ChildAccountService::RegisterProfilePrefs( | 96 void ChildAccountService::RegisterProfilePrefs( |
97 user_prefs::PrefRegistrySyncable* registry) { | 97 user_prefs::PrefRegistrySyncable* registry) { |
98 registry->RegisterBooleanPref(prefs::kChildAccountStatusKnown, false); | 98 registry->RegisterBooleanPref(prefs::kChildAccountStatusKnown, false); |
99 } | 99 } |
100 | 100 |
101 void ChildAccountService::SetIsChildAccount(bool is_child_account) { | 101 void ChildAccountService::SetIsChildAccount(bool is_child_account) { |
102 PropagateChildStatusToUser(is_child_account); | 102 PropagateChildStatusToUser(is_child_account); |
103 if (profile_->IsChild() != is_child_account) { | 103 if (profile_->IsChild() != is_child_account) { |
104 if (is_child_account) { | 104 if (is_child_account) { |
105 profile_->GetPrefs()->SetString(prefs::kSupervisedUserId, | 105 profile_->GetPrefs()->SetString(prefs::kSupervisedUserId, |
106 supervised_users::kChildAccountSUID); | 106 supervised_users::GetChildAccountSUID().Ge
tUserEmail()); |
107 } else { | 107 } else { |
108 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserId); | 108 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserId); |
109 } | 109 } |
110 } | 110 } |
111 profile_->GetPrefs()->SetBoolean(prefs::kChildAccountStatusKnown, true); | 111 profile_->GetPrefs()->SetBoolean(prefs::kChildAccountStatusKnown, true); |
112 | 112 |
113 for (const auto& callback : status_received_callback_list_) | 113 for (const auto& callback : status_received_callback_list_) |
114 callback.Run(); | 114 callback.Run(); |
115 status_received_callback_list_.clear(); | 115 status_received_callback_list_.clear(); |
116 } | 116 } |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 } | 382 } |
383 | 383 |
384 void ChildAccountService::ClearSecondCustodianPrefs() { | 384 void ChildAccountService::ClearSecondCustodianPrefs() { |
385 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserSecondCustodianName); | 385 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserSecondCustodianName); |
386 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserSecondCustodianEmail); | 386 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserSecondCustodianEmail); |
387 profile_->GetPrefs()->ClearPref( | 387 profile_->GetPrefs()->ClearPref( |
388 prefs::kSupervisedUserSecondCustodianProfileURL); | 388 prefs::kSupervisedUserSecondCustodianProfileURL); |
389 profile_->GetPrefs()->ClearPref( | 389 profile_->GetPrefs()->ClearPref( |
390 prefs::kSupervisedUserSecondCustodianProfileImageURL); | 390 prefs::kSupervisedUserSecondCustodianProfileImageURL); |
391 } | 391 } |
OLD | NEW |