| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 if (command_line->HasSwitch(switches::kEnableChildAccountDetection)) | 88 if (command_line->HasSwitch(switches::kEnableChildAccountDetection)) |
| 89 return true; | 89 return true; |
| 90 | 90 |
| 91 if (group_name == "Disabled") | 91 if (group_name == "Disabled") |
| 92 return false; | 92 return false; |
| 93 return true; | 93 return true; |
| 94 } | 94 } |
| 95 | 95 |
| 96 void ChildAccountService::RegisterProfilePrefs( | 96 void ChildAccountService::RegisterProfilePrefs( |
| 97 user_prefs::PrefRegistrySyncable* registry) { | 97 user_prefs::PrefRegistrySyncable* registry) { |
| 98 registry->RegisterBooleanPref( | 98 registry->RegisterBooleanPref(prefs::kChildAccountStatusKnown, false); |
| 99 prefs::kChildAccountStatusKnown, | |
| 100 false, | |
| 101 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 102 } | 99 } |
| 103 | 100 |
| 104 void ChildAccountService::SetIsChildAccount(bool is_child_account) { | 101 void ChildAccountService::SetIsChildAccount(bool is_child_account) { |
| 105 PropagateChildStatusToUser(is_child_account); | 102 PropagateChildStatusToUser(is_child_account); |
| 106 if (profile_->IsChild() != is_child_account) { | 103 if (profile_->IsChild() != is_child_account) { |
| 107 if (is_child_account) { | 104 if (is_child_account) { |
| 108 profile_->GetPrefs()->SetString(prefs::kSupervisedUserId, | 105 profile_->GetPrefs()->SetString(prefs::kSupervisedUserId, |
| 109 supervised_users::kChildAccountSUID); | 106 supervised_users::kChildAccountSUID); |
| 110 } else { | 107 } else { |
| 111 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserId); | 108 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserId); |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 } | 382 } |
| 386 | 383 |
| 387 void ChildAccountService::ClearSecondCustodianPrefs() { | 384 void ChildAccountService::ClearSecondCustodianPrefs() { |
| 388 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserSecondCustodianName); | 385 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserSecondCustodianName); |
| 389 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserSecondCustodianEmail); | 386 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserSecondCustodianEmail); |
| 390 profile_->GetPrefs()->ClearPref( | 387 profile_->GetPrefs()->ClearPref( |
| 391 prefs::kSupervisedUserSecondCustodianProfileURL); | 388 prefs::kSupervisedUserSecondCustodianProfileURL); |
| 392 profile_->GetPrefs()->ClearPref( | 389 profile_->GetPrefs()->ClearPref( |
| 393 prefs::kSupervisedUserSecondCustodianProfileImageURL); | 390 prefs::kSupervisedUserSecondCustodianProfileImageURL); |
| 394 } | 391 } |
| OLD | NEW |