| 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/feature_list.h" | 9 #include "base/feature_list.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 289 |
| 290 void ChildAccountService::ScheduleNextFamilyInfoUpdate(base::TimeDelta delay) { | 290 void ChildAccountService::ScheduleNextFamilyInfoUpdate(base::TimeDelta delay) { |
| 291 family_fetch_timer_.Start( | 291 family_fetch_timer_.Start( |
| 292 FROM_HERE, delay, this, &ChildAccountService::StartFetchingFamilyInfo); | 292 FROM_HERE, delay, this, &ChildAccountService::StartFetchingFamilyInfo); |
| 293 } | 293 } |
| 294 | 294 |
| 295 void ChildAccountService::PropagateChildStatusToUser(bool is_child) { | 295 void ChildAccountService::PropagateChildStatusToUser(bool is_child) { |
| 296 #if defined(OS_CHROMEOS) | 296 #if defined(OS_CHROMEOS) |
| 297 user_manager::User* user = | 297 user_manager::User* user = |
| 298 chromeos::ProfileHelper::Get()->GetUserByProfile(profile_); | 298 chromeos::ProfileHelper::Get()->GetUserByProfile(profile_); |
| 299 if (user) { | 299 if (user) |
| 300 user_manager::UserManager::Get()->ChangeUserChildStatus(user, is_child); | 300 user_manager::UserManager::Get()->ChangeUserChildStatus(user, is_child); |
| 301 } else { | 301 else if (!chromeos::ProfileHelper::Get()->IsSigninProfile(profile_)) |
| 302 LOG(WARNING) << | 302 LOG(DFATAL) << "User instance not found while setting child account flag."; |
| 303 "User instance wasn't found while setting child account flag."; | |
| 304 } | |
| 305 #endif | 303 #endif |
| 306 } | 304 } |
| 307 | 305 |
| 308 void ChildAccountService::SetFirstCustodianPrefs( | 306 void ChildAccountService::SetFirstCustodianPrefs( |
| 309 const FamilyInfoFetcher::FamilyMember& custodian) { | 307 const FamilyInfoFetcher::FamilyMember& custodian) { |
| 310 profile_->GetPrefs()->SetString(prefs::kSupervisedUserCustodianName, | 308 profile_->GetPrefs()->SetString(prefs::kSupervisedUserCustodianName, |
| 311 custodian.display_name); | 309 custodian.display_name); |
| 312 profile_->GetPrefs()->SetString(prefs::kSupervisedUserCustodianEmail, | 310 profile_->GetPrefs()->SetString(prefs::kSupervisedUserCustodianEmail, |
| 313 custodian.email); | 311 custodian.email); |
| 314 profile_->GetPrefs()->SetString(prefs::kSupervisedUserCustodianProfileURL, | 312 profile_->GetPrefs()->SetString(prefs::kSupervisedUserCustodianProfileURL, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 341 } | 339 } |
| 342 | 340 |
| 343 void ChildAccountService::ClearSecondCustodianPrefs() { | 341 void ChildAccountService::ClearSecondCustodianPrefs() { |
| 344 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserSecondCustodianName); | 342 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserSecondCustodianName); |
| 345 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserSecondCustodianEmail); | 343 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserSecondCustodianEmail); |
| 346 profile_->GetPrefs()->ClearPref( | 344 profile_->GetPrefs()->ClearPref( |
| 347 prefs::kSupervisedUserSecondCustodianProfileURL); | 345 prefs::kSupervisedUserSecondCustodianProfileURL); |
| 348 profile_->GetPrefs()->ClearPref( | 346 profile_->GetPrefs()->ClearPref( |
| 349 prefs::kSupervisedUserSecondCustodianProfileImageURL); | 347 prefs::kSupervisedUserSecondCustodianProfileImageURL); |
| 350 } | 348 } |
| OLD | NEW |