Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3311)

Unified Diff: chrome/browser/supervised_user/child_accounts/child_account_service.cc

Issue 986303002: Re-enable child account detection, now behind a flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: strings Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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() {

Powered by Google App Engine
This is Rietveld 408576698