Chromium Code Reviews| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 | 145 |
| 146 settings_service->SetLocalSetting( | 146 settings_service->SetLocalSetting( |
| 147 supervised_users::kRecordHistoryIncludesSessionSync, | 147 supervised_users::kRecordHistoryIncludesSessionSync, |
| 148 base::MakeUnique<base::FundamentalValue>(false)); | 148 base::MakeUnique<base::FundamentalValue>(false)); |
| 149 | 149 |
| 150 // In contrast to legacy SUs, child account SUs must sign in. | 150 // In contrast to legacy SUs, child account SUs must sign in. |
| 151 settings_service->SetLocalSetting( | 151 settings_service->SetLocalSetting( |
| 152 supervised_users::kSigninAllowed, | 152 supervised_users::kSigninAllowed, |
| 153 base::MakeUnique<base::FundamentalValue>(true)); | 153 base::MakeUnique<base::FundamentalValue>(true)); |
| 154 | 154 |
| 155 // Always allow cookies, to avoid website compatibility issues. | |
| 156 settings_service->SetLocalSetting( | |
| 157 supervised_users::kCookiesAlwaysAllowed, | |
| 158 base::MakeUnique<base::FundamentalValue>(true)); | |
| 159 | |
| 155 // SafeSearch is controlled at the account level, so don't override it | 160 // SafeSearch is controlled at the account level, so don't override it |
| 156 // client-side. | 161 // client-side. |
| 157 settings_service->SetLocalSetting( | 162 settings_service->SetLocalSetting( |
| 158 supervised_users::kForceSafeSearch, | 163 supervised_users::kForceSafeSearch, |
| 159 base::MakeUnique<base::FundamentalValue>(false)); | 164 base::MakeUnique<base::FundamentalValue>(false)); |
| 160 | 165 |
| 161 #if !defined(OS_CHROMEOS) | 166 #if !defined(OS_CHROMEOS) |
| 162 // This is also used by user policies (UserPolicySigninService), but since | 167 // This is also used by user policies (UserPolicySigninService), but since |
| 163 // child accounts can not also be Dasher accounts, there shouldn't be any | 168 // child accounts can not also be Dasher accounts, there shouldn't be any |
| 164 // problems. | 169 // problems. |
| 165 SigninManagerFactory::GetForProfile(profile_)->ProhibitSignout(true); | 170 SigninManagerFactory::GetForProfile(profile_)->ProhibitSignout(true); |
| 166 #endif | 171 #endif |
| 167 | 172 |
| 168 // TODO(treib): Maybe store the last update time in a pref, so we don't | 173 // TODO(treib): Maybe store the last update time in a pref, so we don't |
| 169 // have to re-fetch on every start. | 174 // have to re-fetch on every start. |
| 170 StartFetchingFamilyInfo(); | 175 StartFetchingFamilyInfo(); |
| 171 | 176 |
| 172 SupervisedUserService* service = | 177 SupervisedUserService* service = |
| 173 SupervisedUserServiceFactory::GetForProfile(profile_); | 178 SupervisedUserServiceFactory::GetForProfile(profile_); |
| 174 service->AddPermissionRequestCreator( | 179 service->AddPermissionRequestCreator( |
| 175 PermissionRequestCreatorApiary::CreateWithProfile(profile_)); | 180 PermissionRequestCreatorApiary::CreateWithProfile(profile_)); |
| 176 if (base::FeatureList::IsEnabled(features::kSafeSearchUrlReporting)) { | 181 if (base::FeatureList::IsEnabled(features::kSafeSearchUrlReporting)) { |
| 177 service->SetSafeSearchURLReporter( | 182 service->SetSafeSearchURLReporter( |
| 178 SafeSearchURLReporter::CreateWithProfile(profile_)); | 183 SafeSearchURLReporter::CreateWithProfile(profile_)); |
| 179 } | 184 } |
| 180 } else { | 185 } else { |
| 181 SupervisedUserSettingsService* settings_service = | 186 SupervisedUserSettingsService* settings_service = |
| 182 SupervisedUserSettingsServiceFactory::GetForProfile(profile_); | 187 SupervisedUserSettingsServiceFactory::GetForProfile(profile_); |
| 188 settings_service->SetLocalSetting( | |
| 189 supervised_users::kRecordHistoryIncludesSessionSync, nullptr); | |
| 183 settings_service->SetLocalSetting(supervised_users::kSigninAllowed, | 190 settings_service->SetLocalSetting(supervised_users::kSigninAllowed, |
| 184 std::unique_ptr<base::Value>()); | 191 nullptr); |
| 192 settings_service->SetLocalSetting(supervised_users::kCookiesAlwaysAllowed, | |
| 193 nullptr); | |
| 194 settings_service->SetLocalSetting(supervised_users::kForceSafeSearch, | |
| 195 nullptr); | |
|
Marc Treib
2017/01/16 17:24:40
Are these changes required? Were things broken bef
Bernhard Bauer
2017/01/17 13:54:13
Probably? :) The case where a profile changes from
Marc Treib
2017/01/17 13:57:54
Interesting ;-)
It's also possible that SU setting
| |
| 196 | |
| 185 #if !defined(OS_CHROMEOS) | 197 #if !defined(OS_CHROMEOS) |
| 186 SigninManagerFactory::GetForProfile(profile_)->ProhibitSignout(false); | 198 SigninManagerFactory::GetForProfile(profile_)->ProhibitSignout(false); |
| 187 #endif | 199 #endif |
| 188 | 200 |
| 189 CancelFetchingFamilyInfo(); | 201 CancelFetchingFamilyInfo(); |
| 190 } | 202 } |
| 191 | 203 |
| 192 // Trigger a sync reconfig to enable/disable the right SU data types. | 204 // Trigger a sync reconfig to enable/disable the right SU data types. |
| 193 // The logic to do this lives in the SupervisedUserSyncDataTypeController. | 205 // The logic to do this lives in the SupervisedUserSyncDataTypeController. |
| 194 browser_sync::ProfileSyncService* sync_service = | 206 browser_sync::ProfileSyncService* sync_service = |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 335 } | 347 } |
| 336 | 348 |
| 337 void ChildAccountService::ClearSecondCustodianPrefs() { | 349 void ChildAccountService::ClearSecondCustodianPrefs() { |
| 338 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserSecondCustodianName); | 350 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserSecondCustodianName); |
| 339 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserSecondCustodianEmail); | 351 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserSecondCustodianEmail); |
| 340 profile_->GetPrefs()->ClearPref( | 352 profile_->GetPrefs()->ClearPref( |
| 341 prefs::kSupervisedUserSecondCustodianProfileURL); | 353 prefs::kSupervisedUserSecondCustodianProfileURL); |
| 342 profile_->GetPrefs()->ClearPref( | 354 profile_->GetPrefs()->ClearPref( |
| 343 prefs::kSupervisedUserSecondCustodianProfileImageURL); | 355 prefs::kSupervisedUserSecondCustodianProfileImageURL); |
| 344 } | 356 } |
| OLD | NEW |