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/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 profile_->GetPrefs()->SetString(prefs::kSupervisedUserId, | 244 profile_->GetPrefs()->SetString(prefs::kSupervisedUserId, |
245 supervised_users::kChildAccountSUID); | 245 supervised_users::kChildAccountSUID); |
246 } else { | 246 } else { |
247 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserId); | 247 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserId); |
248 } | 248 } |
249 PropagateChildStatusToUser(is_child_account); | 249 PropagateChildStatusToUser(is_child_account); |
250 } | 250 } |
251 | 251 |
252 void ChildAccountService::PropagateChildStatusToUser(bool is_child) { | 252 void ChildAccountService::PropagateChildStatusToUser(bool is_child) { |
253 #if defined(OS_CHROMEOS) | 253 #if defined(OS_CHROMEOS) |
254 // TODO(merkulova,treib): Figure out why this causes tests to fail. | 254 user_manager::User* user = |
255 // user_manager::User* user = | 255 chromeos::ProfileHelper::Get()->GetUserByProfile(profile_); |
256 // chromeos::ProfileHelper::Get()->GetUserByProfile(profile_); | 256 if (user) { |
257 // if (user) { | 257 user_manager::UserManager::Get()->ChangeUserSupervisedStatus( |
258 // user_manager::UserManager::Get()->ChangeUserSupervisedStatus( | 258 user, is_child); |
259 // user, is_child); | 259 } else { |
260 // } else { | 260 LOG(WARNING) << |
261 // LOG(WARNING) << | 261 "User instance wasn't found while setting child account flag."; |
262 // "User instance wasn't found while setting child account flag."; | 262 } |
263 // } | |
264 #endif | 263 #endif |
265 } | 264 } |
266 | 265 |
267 void ChildAccountService::SetFirstCustodianPrefs( | 266 void ChildAccountService::SetFirstCustodianPrefs( |
268 const FamilyInfoFetcher::FamilyMember& custodian) { | 267 const FamilyInfoFetcher::FamilyMember& custodian) { |
269 profile_->GetPrefs()->SetString(prefs::kSupervisedUserCustodianName, | 268 profile_->GetPrefs()->SetString(prefs::kSupervisedUserCustodianName, |
270 custodian.display_name); | 269 custodian.display_name); |
271 profile_->GetPrefs()->SetString(prefs::kSupervisedUserCustodianEmail, | 270 profile_->GetPrefs()->SetString(prefs::kSupervisedUserCustodianEmail, |
272 custodian.email); | 271 custodian.email); |
273 profile_->GetPrefs()->SetString(prefs::kSupervisedUserCustodianProfileURL, | 272 profile_->GetPrefs()->SetString(prefs::kSupervisedUserCustodianProfileURL, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 command_line->AppendSwitch(switches::kEnableSupervisedUserBlacklist); | 319 command_line->AppendSwitch(switches::kEnableSupervisedUserBlacklist); |
321 | 320 |
322 // Query-based filtering also defaults to enabled. | 321 // Query-based filtering also defaults to enabled. |
323 bool has_enable_safesites = | 322 bool has_enable_safesites = |
324 command_line->HasSwitch(switches::kEnableSupervisedUserSafeSites); | 323 command_line->HasSwitch(switches::kEnableSupervisedUserSafeSites); |
325 bool has_disable_safesites = | 324 bool has_disable_safesites = |
326 command_line->HasSwitch(switches::kDisableSupervisedUserSafeSites); | 325 command_line->HasSwitch(switches::kDisableSupervisedUserSafeSites); |
327 if (!has_enable_safesites && !has_disable_safesites) | 326 if (!has_enable_safesites && !has_disable_safesites) |
328 command_line->AppendSwitch(switches::kEnableSupervisedUserSafeSites); | 327 command_line->AppendSwitch(switches::kEnableSupervisedUserSafeSites); |
329 } | 328 } |
OLD | NEW |