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/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
10 #include "base/values.h" | 11 #include "base/values.h" |
11 #include "build/build_config.h" | 12 #include "build/build_config.h" |
12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/signin/account_tracker_service_factory.h" | 14 #include "chrome/browser/signin/account_tracker_service_factory.h" |
14 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 15 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
15 #include "chrome/browser/signin/signin_manager_factory.h" | 16 #include "chrome/browser/signin/signin_manager_factory.h" |
16 #include "chrome/browser/supervised_user/child_accounts/permission_request_creat
or_apiary.h" | 17 #include "chrome/browser/supervised_user/child_accounts/permission_request_creat
or_apiary.h" |
| 18 #include "chrome/browser/supervised_user/experimental/safe_search_url_reporter.h
" |
17 #include "chrome/browser/supervised_user/supervised_user_constants.h" | 19 #include "chrome/browser/supervised_user/supervised_user_constants.h" |
18 #include "chrome/browser/supervised_user/supervised_user_service.h" | 20 #include "chrome/browser/supervised_user/supervised_user_service.h" |
19 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 21 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
20 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" | 22 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" |
21 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor
y.h" | 23 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor
y.h" |
22 #include "chrome/browser/sync/profile_sync_service_factory.h" | 24 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 25 #include "chrome/common/chrome_features.h" |
23 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
24 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
25 #include "components/browser_sync/browser/profile_sync_service.h" | 28 #include "components/browser_sync/browser/profile_sync_service.h" |
26 #include "components/pref_registry/pref_registry_syncable.h" | 29 #include "components/pref_registry/pref_registry_syncable.h" |
27 #include "components/prefs/pref_service.h" | 30 #include "components/prefs/pref_service.h" |
28 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 31 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
29 #include "components/signin/core/browser/signin_manager.h" | 32 #include "components/signin/core/browser/signin_manager.h" |
30 #include "components/signin/core/common/signin_pref_names.h" | 33 #include "components/signin/core/common/signin_pref_names.h" |
31 | 34 |
32 #if defined(OS_CHROMEOS) | 35 #if defined(OS_CHROMEOS) |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 #endif | 164 #endif |
162 | 165 |
163 // TODO(treib): Maybe store the last update time in a pref, so we don't | 166 // TODO(treib): Maybe store the last update time in a pref, so we don't |
164 // have to re-fetch on every start. | 167 // have to re-fetch on every start. |
165 StartFetchingFamilyInfo(); | 168 StartFetchingFamilyInfo(); |
166 | 169 |
167 SupervisedUserService* service = | 170 SupervisedUserService* service = |
168 SupervisedUserServiceFactory::GetForProfile(profile_); | 171 SupervisedUserServiceFactory::GetForProfile(profile_); |
169 service->AddPermissionRequestCreator( | 172 service->AddPermissionRequestCreator( |
170 PermissionRequestCreatorApiary::CreateWithProfile(profile_)); | 173 PermissionRequestCreatorApiary::CreateWithProfile(profile_)); |
| 174 if (base::FeatureList::IsEnabled(features::kSafeSearchUrlReporting)) { |
| 175 service->SetSafeSearchURLReporter( |
| 176 SafeSearchURLReporter::CreateWithProfile(profile_)); |
| 177 } |
171 } else { | 178 } else { |
172 SupervisedUserSettingsService* settings_service = | 179 SupervisedUserSettingsService* settings_service = |
173 SupervisedUserSettingsServiceFactory::GetForProfile(profile_); | 180 SupervisedUserSettingsServiceFactory::GetForProfile(profile_); |
174 settings_service->SetLocalSetting(supervised_users::kSigninAllowed, | 181 settings_service->SetLocalSetting(supervised_users::kSigninAllowed, |
175 scoped_ptr<base::Value>()); | 182 scoped_ptr<base::Value>()); |
176 #if !defined(OS_CHROMEOS) | 183 #if !defined(OS_CHROMEOS) |
177 SigninManagerFactory::GetForProfile(profile_)->ProhibitSignout(false); | 184 SigninManagerFactory::GetForProfile(profile_)->ProhibitSignout(false); |
178 #endif | 185 #endif |
179 | 186 |
180 CancelFetchingFamilyInfo(); | 187 CancelFetchingFamilyInfo(); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 } | 335 } |
329 | 336 |
330 void ChildAccountService::ClearSecondCustodianPrefs() { | 337 void ChildAccountService::ClearSecondCustodianPrefs() { |
331 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserSecondCustodianName); | 338 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserSecondCustodianName); |
332 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserSecondCustodianEmail); | 339 profile_->GetPrefs()->ClearPref(prefs::kSupervisedUserSecondCustodianEmail); |
333 profile_->GetPrefs()->ClearPref( | 340 profile_->GetPrefs()->ClearPref( |
334 prefs::kSupervisedUserSecondCustodianProfileURL); | 341 prefs::kSupervisedUserSecondCustodianProfileURL); |
335 profile_->GetPrefs()->ClearPref( | 342 profile_->GetPrefs()->ClearPref( |
336 prefs::kSupervisedUserSecondCustodianProfileImageURL); | 343 prefs::kSupervisedUserSecondCustodianProfileImageURL); |
337 } | 344 } |
OLD | NEW |