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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 #endif | 174 #endif |
175 | 175 |
176 // TODO(treib): Maybe store the last update time in a pref, so we don't | 176 // TODO(treib): Maybe store the last update time in a pref, so we don't |
177 // have to re-fetch on every start. | 177 // have to re-fetch on every start. |
178 StartFetchingFamilyInfo(); | 178 StartFetchingFamilyInfo(); |
179 | 179 |
180 SupervisedUserService* service = | 180 SupervisedUserService* service = |
181 SupervisedUserServiceFactory::GetForProfile(profile_); | 181 SupervisedUserServiceFactory::GetForProfile(profile_); |
182 service->AddPermissionRequestCreator( | 182 service->AddPermissionRequestCreator( |
183 PermissionRequestCreatorApiary::CreateWithProfile(profile_)); | 183 PermissionRequestCreatorApiary::CreateWithProfile(profile_)); |
184 | |
185 EnableExperimentalFiltering(); | |
186 } else { | 184 } else { |
187 SupervisedUserSettingsService* settings_service = | 185 SupervisedUserSettingsService* settings_service = |
188 SupervisedUserSettingsServiceFactory::GetForProfile(profile_); | 186 SupervisedUserSettingsServiceFactory::GetForProfile(profile_); |
189 settings_service->SetLocalSetting(supervised_users::kSigninAllowed, | 187 settings_service->SetLocalSetting(supervised_users::kSigninAllowed, |
190 scoped_ptr<base::Value>()); | 188 scoped_ptr<base::Value>()); |
191 #if !defined(OS_CHROMEOS) | 189 #if !defined(OS_CHROMEOS) |
192 SigninManagerFactory::GetForProfile(profile_)->ProhibitSignout(false); | 190 SigninManagerFactory::GetForProfile(profile_)->ProhibitSignout(false); |
193 #endif | 191 #endif |
194 | 192 |
195 ClearFirstCustodianPrefs(); | 193 ClearFirstCustodianPrefs(); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 } | 417 } |
420 | 418 |
421 void ChildAccountService::ClearSecondCustodianPrefs() { | 419 void ChildAccountService::ClearSecondCustodianPrefs() { |
422 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserSecondCustodianName); | 420 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserSecondCustodianName); |
423 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserSecondCustodianEmail); | 421 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserSecondCustodianEmail); |
424 profile_->GetPrefs()->ClearPref( | 422 profile_->GetPrefs()->ClearPref( |
425 prefs::kSupervisedUserSecondCustodianProfileURL); | 423 prefs::kSupervisedUserSecondCustodianProfileURL); |
426 profile_->GetPrefs()->ClearPref( | 424 profile_->GetPrefs()->ClearPref( |
427 prefs::kSupervisedUserSecondCustodianProfileImageURL); | 425 prefs::kSupervisedUserSecondCustodianProfileImageURL); |
428 } | 426 } |
429 | |
430 void ChildAccountService::EnableExperimentalFiltering() { | |
431 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
432 | |
433 // Static blacklist defaults to enabled. | |
434 bool has_enable_blacklist = | |
435 command_line->HasSwitch(switches::kEnableSupervisedUserBlacklist); | |
436 bool has_disable_blacklist = | |
437 command_line->HasSwitch(switches::kDisableSupervisedUserBlacklist); | |
438 if (!has_enable_blacklist && !has_disable_blacklist) | |
439 command_line->AppendSwitch(switches::kEnableSupervisedUserBlacklist); | |
440 | |
441 // Query-based filtering also defaults to enabled. | |
442 bool has_enable_safesites = | |
443 command_line->HasSwitch(switches::kEnableSupervisedUserSafeSites); | |
444 bool has_disable_safesites = | |
445 command_line->HasSwitch(switches::kDisableSupervisedUserSafeSites); | |
446 if (!has_enable_safesites && !has_disable_safesites) | |
447 command_line->AppendSwitch(switches::kEnableSupervisedUserSafeSites); | |
448 } | |
OLD | NEW |