Index: chrome/browser/supervised_user/child_accounts/child_account_service.cc |
diff --git a/chrome/browser/supervised_user/child_accounts/child_account_service.cc b/chrome/browser/supervised_user/child_accounts/child_account_service.cc |
index 1e906124a4b7ba4cd6950fc33d535a2f32049a8e..a61e9497744b838f63f30459730d057123c884b5 100644 |
--- a/chrome/browser/supervised_user/child_accounts/child_account_service.cc |
+++ b/chrome/browser/supervised_user/child_accounts/child_account_service.cc |
@@ -238,6 +238,15 @@ void ChildAccountService::OnFailure(FamilyInfoFetcher::ErrorCode error) { |
ScheduleNextFamilyInfoUpdate(family_fetch_backoff_.GetTimeUntilRelease()); |
} |
+bool ChildAccountService::IsChildAccountDetectionEnabled() const { |
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
+ bool is_enabled = |
+ command_line->HasSwitch(switches::kEnableChildAccountDetection); |
+ bool is_disabled = |
+ command_line->HasSwitch(switches::kDisableChildAccountDetection); |
+ return is_enabled && !is_disabled; |
+} |
+ |
void ChildAccountService::StartFetchingFamilyInfo() { |
family_fetcher_.reset(new FamilyInfoFetcher( |
this, |
@@ -259,8 +268,18 @@ void ChildAccountService::ScheduleNextFamilyInfoUpdate(base::TimeDelta delay) { |
} |
void ChildAccountService::StartFetchingServiceFlags() { |
+ if (!IsChildAccountDetectionEnabled()) { |
+ SetIsChildAccount(false); |
+ return; |
+ } |
account_id_ = SigninManagerFactory::GetForProfile(profile_) |
->GetAuthenticatedAccountId(); |
+ flag_fetcher_.reset(new AccountServiceFlagFetcher( |
+ account_id_, |
+ ProfileOAuth2TokenServiceFactory::GetForProfile(profile_), |
+ profile_->GetRequestContext(), |
+ base::Bind(&ChildAccountService::OnFlagsFetched, |
+ weak_ptr_factory_.GetWeakPtr()))); |
} |
void ChildAccountService::CancelFetchingServiceFlags() { |