Cleaning up unused child account info fetcher.

The fetcher is only used in Android now, and its usage has been
protected with Android OS macros. For information on how a child
account is detected on Chrome OS, refer to the DD: goo.gl/MhFXdo.

Bug: 791513
Change-Id: I24acf6eed723087cbb44e93cec93ceac4bf1f2f6
Reviewed-on: https://chromium-review.googlesource.com/c/1391306
Commit-Queue: Luciana Maroun <maroun@chromium.org>
Reviewed-by: Mihai Sardarescu <msarda@chromium.org>
Reviewed-by: Bernhard Bauer <bauerb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#621557}
diff --git a/components/signin/core/browser/BUILD.gn b/components/signin/core/browser/BUILD.gn
index 8fd3fa5..6c9ec40 100644
--- a/components/signin/core/browser/BUILD.gn
+++ b/components/signin/core/browser/BUILD.gn
@@ -115,12 +115,8 @@
     "account_reconcilor_delegate.h",
     "avatar_icon_util.cc",
     "avatar_icon_util.h",
-    "child_account_info_fetcher.cc",
-    "child_account_info_fetcher.h",
     "child_account_info_fetcher_android.cc",
     "child_account_info_fetcher_android.h",
-    "child_account_info_fetcher_impl.cc",
-    "child_account_info_fetcher_impl.h",
     "chrome_connected_header_helper.cc",
     "chrome_connected_header_helper.h",
     "cookie_settings_util.cc",
@@ -131,6 +127,8 @@
     "dice_header_helper.h",
     "mirror_account_reconcilor_delegate.cc",
     "mirror_account_reconcilor_delegate.h",
+    "oauth2_token_service_delegate_android.cc",
+    "oauth2_token_service_delegate_android.h",
     "signin_error_controller.cc",
     "signin_error_controller.h",
     "signin_header_helper.cc",
@@ -204,14 +202,6 @@
   }
 
   if (is_android) {
-    sources -= [
-      "child_account_info_fetcher_impl.cc",
-      "child_account_info_fetcher_impl.h",
-    ]
-    sources += [
-      "oauth2_token_service_delegate_android.cc",
-      "oauth2_token_service_delegate_android.h",
-    ]
     deps += [ "android:jni_headers" ]
   }
 }
diff --git a/components/signin/core/browser/account_fetcher_service.cc b/components/signin/core/browser/account_fetcher_service.cc
index 1c341005..23a8aa3 100644
--- a/components/signin/core/browser/account_fetcher_service.cc
+++ b/components/signin/core/browser/account_fetcher_service.cc
@@ -17,11 +17,14 @@
 #include "components/signin/core/browser/account_info_fetcher.h"
 #include "components/signin/core/browser/account_tracker_service.h"
 #include "components/signin/core/browser/avatar_icon_util.h"
-#include "components/signin/core/browser/child_account_info_fetcher.h"
 #include "components/signin/core/browser/signin_client.h"
 #include "components/signin/core/browser/signin_switches.h"
 #include "services/network/public/cpp/shared_url_loader_factory.h"
 
+#if defined(OS_ANDROID)
+#include "components/signin/core/browser/child_account_info_fetcher_android.h"
+#endif
+
 namespace {
 
 const base::TimeDelta kRefreshFromTokenServiceDelay =
@@ -53,8 +56,11 @@
       profile_loaded_(false),
       refresh_tokens_loaded_(false),
       shutdown_called_(false),
-      scheduled_refresh_enabled_(true),
-      child_info_request_(nullptr) {}
+#if defined(OS_ANDROID)
+      child_info_request_(nullptr),
+#endif
+      scheduled_refresh_enabled_(true) {
+}
 
 AccountFetcherService::~AccountFetcherService() {
   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
@@ -91,9 +97,11 @@
 
 void AccountFetcherService::Shutdown() {
   token_service_->RemoveObserver(this);
+#if defined(OS_ANDROID)
   // child_info_request_ is an invalidation handler and needs to be
   // unregistered during the lifetime of the invalidation service.
   child_info_request_.reset();
+#endif
   invalidation_service_ = nullptr;
   shutdown_called_ = true;
 }
@@ -113,7 +121,9 @@
   DCHECK(!invalidation_service_);
   DCHECK(!profile_loaded_);
   DCHECK(!network_fetches_enabled_);
+#if defined(OS_ANDROID)
   DCHECK(!child_info_request_);
+#endif
   invalidation_service_ = invalidation_service;
   profile_loaded_ = true;
   MaybeEnableNetworkFetches();
@@ -215,12 +225,12 @@
   }
 }
 
+#if defined(OS_ANDROID)
 // Starts fetching whether this is a child account. Handles refresh internally.
 void AccountFetcherService::StartFetchingChildInfo(
     const std::string& account_id) {
-  child_info_request_ = ChildAccountInfoFetcher::CreateFrom(
-      child_request_account_id_, this, token_service_,
-      signin_client_->GetURLLoaderFactory(), invalidation_service_);
+  child_info_request_ =
+      ChildAccountInfoFetcherAndroid::Create(this, child_request_account_id_);
 }
 
 void AccountFetcherService::ResetChildInfo() {
@@ -230,6 +240,13 @@
   child_info_request_.reset();
 }
 
+void AccountFetcherService::SetIsChildAccount(const std::string& account_id,
+                                              bool is_child_account) {
+  if (child_request_account_id_ == account_id)
+    account_tracker_service_->SetIsChildAccount(account_id, is_child_account);
+}
+#endif
+
 void AccountFetcherService::RefreshAccountInfo(const std::string& account_id,
                                                bool only_fetch_if_invalid) {
   DCHECK(network_fetches_enabled_);
@@ -309,12 +326,6 @@
                                         callback, traffic_annotation);
 }
 
-void AccountFetcherService::SetIsChildAccount(const std::string& account_id,
-                                              bool is_child_account) {
-  if (child_request_account_id_ == account_id)
-    account_tracker_service_->SetIsChildAccount(account_id, is_child_account);
-}
-
 void AccountFetcherService::OnUserInfoFetchFailure(
     const std::string& account_id) {
   LOG(WARNING) << "Failed to get UserInfo for " << account_id;
diff --git a/components/signin/core/browser/account_fetcher_service.h b/components/signin/core/browser/account_fetcher_service.h
index 77eb459..7ced83d 100644
--- a/components/signin/core/browser/account_fetcher_service.h
+++ b/components/signin/core/browser/account_fetcher_service.h
@@ -13,17 +13,21 @@
 #include "base/macros.h"
 #include "base/sequence_checker.h"
 #include "base/timer/timer.h"
+#include "build/build_config.h"
 #include "components/keyed_service/core/keyed_service.h"
 #include "google_apis/gaia/oauth2_token_service.h"
 #include "ui/gfx/image/image.h"
 
 class AccountInfoFetcher;
 class AccountTrackerService;
-class ChildAccountInfoFetcher;
 class OAuth2TokenService;
 class PrefRegistrySimple;
 class SigninClient;
 
+#if defined(OS_ANDROID)
+class ChildAccountInfoFetcherAndroid;
+#endif
+
 namespace base {
 class DictionaryValue;
 }
@@ -38,9 +42,6 @@
 class InvalidationService;
 }
 
-// TODO(maroun): Protect with macro for Android only everything that is related
-// to child account info fetching.
-
 class AccountFetcherService : public KeyedService,
                               public OAuth2TokenService::Observer {
  public:
@@ -83,8 +84,10 @@
 
   void EnableNetworkFetchesForTest();
 
-  // Called by ChildAccountInfoFetcher.
+#if defined(OS_ANDROID)
+  // Called by ChildAccountInfoFetcherAndroid.
   void SetIsChildAccount(const std::string& account_id, bool is_child_account);
+#endif
 
   // OAuth2TokenService::Observer implementation.
   void OnRefreshTokenAvailable(const std::string& account_id) override;
@@ -93,15 +96,16 @@
 
  private:
   friend class AccountInfoFetcher;
-  friend class ChildAccountInfoFetcherImpl;
 
   void RefreshAllAccountInfo(bool only_fetch_if_invalid);
   void RefreshAllAccountsAndScheduleNext();
   void ScheduleNextRefresh();
 
+#if defined(OS_ANDROID)
   // Called on all account state changes. Decides whether to fetch new child
   // status information or reset old values that aren't valid now.
   void UpdateChildInfo();
+#endif
 
   void MaybeEnableNetworkFetches();
 
@@ -109,11 +113,13 @@
   // Further the two fetches are managed by a different refresh logic and
   // thus, can not be combined.
   virtual void StartFetchingUserInfo(const std::string& account_id);
+#if defined(OS_ANDROID)
   virtual void StartFetchingChildInfo(const std::string& account_id);
 
   // If there is more than one account in a profile, we forcibly reset the
   // child status for an account to be false.
   void ResetChildInfo();
+#endif
 
   // Refreshes the AccountInfo associated with |account_id|.
   void RefreshAccountInfo(const std::string& account_id,
@@ -143,12 +149,15 @@
   base::Time last_updated_;
   base::OneShotTimer timer_;
   bool shutdown_called_;
+
+#if defined(OS_ANDROID)
+  std::string child_request_account_id_;
+  std::unique_ptr<ChildAccountInfoFetcherAndroid> child_info_request_;
+#endif
+
   // Only disabled in tests.
   bool scheduled_refresh_enabled_;
 
-  std::string child_request_account_id_;
-  std::unique_ptr<ChildAccountInfoFetcher> child_info_request_;
-
   // Holds references to account info fetchers keyed by account_id.
   std::unordered_map<std::string, std::unique_ptr<AccountInfoFetcher>>
       user_info_requests_;
diff --git a/components/signin/core/browser/account_tracker_service_unittest.cc b/components/signin/core/browser/account_tracker_service_unittest.cc
index e796e3c..0648a3c 100644
--- a/components/signin/core/browser/account_tracker_service_unittest.cc
+++ b/components/signin/core/browser/account_tracker_service_unittest.cc
@@ -21,7 +21,6 @@
 #include "components/signin/core/browser/account_info.h"
 #include "components/signin/core/browser/account_tracker_service.h"
 #include "components/signin/core/browser/avatar_icon_util.h"
-#include "components/signin/core/browser/child_account_info_fetcher.h"
 #include "components/signin/core/browser/fake_account_fetcher_service.h"
 #include "components/signin/core/browser/signin_pref_names.h"
 #include "components/signin/core/browser/test_signin_client.h"
@@ -33,6 +32,10 @@
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
+#if defined(OS_ANDROID)
+#include "components/signin/core/browser/child_account_info_fetcher_android.h"
+#endif
+
 namespace {
 // Simple wrapper around a static string; used to avoid implicit conversion
 // of the account key to an std::string (which is the type used for account
@@ -232,7 +235,9 @@
 class AccountTrackerServiceTest : public testing::Test {
  public:
   AccountTrackerServiceTest() : signin_client_(&pref_service_) {
-    ChildAccountInfoFetcher::InitializeForTests();
+#if defined(OS_ANDROID)
+    ChildAccountInfoFetcherAndroid::InitializeForTests();
+#endif
 
     AccountTrackerService::RegisterPrefs(pref_service_.registry());
     AccountFetcherService::RegisterPrefs(pref_service_.registry());
diff --git a/components/signin/core/browser/child_account_info_fetcher.cc b/components/signin/core/browser/child_account_info_fetcher.cc
deleted file mode 100644
index bc8e267..0000000
--- a/components/signin/core/browser/child_account_info_fetcher.cc
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/signin/core/browser/child_account_info_fetcher.h"
-
-#include "build/build_config.h"
-
-#include "services/network/public/cpp/shared_url_loader_factory.h"
-#if defined(OS_ANDROID)
-#include "components/signin/core/browser/child_account_info_fetcher_android.h"
-#else
-#include "components/signin/core/browser/child_account_info_fetcher_impl.h"
-#endif
-
-// static
-std::unique_ptr<ChildAccountInfoFetcher> ChildAccountInfoFetcher::CreateFrom(
-    const std::string& account_id,
-    AccountFetcherService* fetcher_service,
-    OAuth2TokenService* token_service,
-    scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
-    invalidation::InvalidationService* invalidation_service) {
-#if defined(OS_ANDROID)
-  return ChildAccountInfoFetcherAndroid::Create(fetcher_service, account_id);
-#else
-  return std::make_unique<ChildAccountInfoFetcherImpl>(
-      account_id, fetcher_service, token_service, url_loader_factory,
-      invalidation_service);
-#endif
-}
-
-ChildAccountInfoFetcher::~ChildAccountInfoFetcher() {
-}
-
-void ChildAccountInfoFetcher::InitializeForTests() {
-#if defined(OS_ANDROID)
-  ChildAccountInfoFetcherAndroid::InitializeForTests();
-#endif
-}
diff --git a/components/signin/core/browser/child_account_info_fetcher.h b/components/signin/core/browser/child_account_info_fetcher.h
deleted file mode 100644
index f5891f5c..0000000
--- a/components/signin/core/browser/child_account_info_fetcher.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_SIGNIN_CORE_BROWSER_CHILD_ACCOUNT_INFO_FETCHER_H_
-#define COMPONENTS_SIGNIN_CORE_BROWSER_CHILD_ACCOUNT_INFO_FETCHER_H_
-
-#include <memory>
-#include <string>
-
-#include "base/memory/ref_counted.h"
-#include "build/build_config.h"
-
-#if defined(OS_ANDROID)
-#include <jni.h>
-#endif
-
-namespace invalidation {
-class InvalidationService;
-}
-namespace network {
-class SharedURLLoaderFactory;
-}
-class AccountFetcherService;
-class OAuth2TokenService;
-
-class ChildAccountInfoFetcher {
- public:
-  // Caller takes ownership of the fetcher and keeps it alive in order to
-  // receive updates.
-  static std::unique_ptr<ChildAccountInfoFetcher> CreateFrom(
-      const std::string& account_id,
-      AccountFetcherService* fetcher_service,
-      OAuth2TokenService* token_service,
-      scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
-      invalidation::InvalidationService* invalidation_service);
-  virtual ~ChildAccountInfoFetcher();
-
-  static void InitializeForTests();
-};
-
-#endif  // COMPONENTS_SIGNIN_CORE_BROWSER_CHILD_ACCOUNT_INFO_FETCHER_H_
diff --git a/components/signin/core/browser/child_account_info_fetcher_android.cc b/components/signin/core/browser/child_account_info_fetcher_android.cc
index 29935b1..85c6304d 100644
--- a/components/signin/core/browser/child_account_info_fetcher_android.cc
+++ b/components/signin/core/browser/child_account_info_fetcher_android.cc
@@ -8,6 +8,7 @@
 
 #include "base/android/jni_android.h"
 #include "base/android/jni_string.h"
+#include "base/memory/ptr_util.h"
 #include "components/signin/core/browser/account_fetcher_service.h"
 #include "components/signin/core/browser/account_tracker_service.h"
 #include "jni/ChildAccountInfoFetcher_jni.h"
@@ -15,9 +16,9 @@
 using base::android::JavaParamRef;
 
 // static
-std::unique_ptr<ChildAccountInfoFetcher> ChildAccountInfoFetcherAndroid::Create(
-    AccountFetcherService* service,
-    const std::string& account_id) {
+std::unique_ptr<ChildAccountInfoFetcherAndroid>
+ChildAccountInfoFetcherAndroid::Create(AccountFetcherService* service,
+                                       const std::string& account_id) {
   std::string account_name =
       service->account_tracker_service()->GetAccountInfo(account_id).email;
   // The AccountTrackerService may not be populated correctly in tests.
@@ -25,9 +26,8 @@
     return nullptr;
 
   // Call the constructor directly instead of using std::make_unique because the
-  // constructor is private. Also, use the std::unique_ptr<> constructor instead
-  // of base::WrapUnique because the _destructor_ of the subclass is private.
-  return std::unique_ptr<ChildAccountInfoFetcher>(
+  // constructor is private.
+  return base::WrapUnique(
       new ChildAccountInfoFetcherAndroid(service, account_id, account_name));
 }
 
diff --git a/components/signin/core/browser/child_account_info_fetcher_android.h b/components/signin/core/browser/child_account_info_fetcher_android.h
index 0b73cce4..1007fe5 100644
--- a/components/signin/core/browser/child_account_info_fetcher_android.h
+++ b/components/signin/core/browser/child_account_info_fetcher_android.h
@@ -9,15 +9,15 @@
 #include <string>
 
 #include "base/android/scoped_java_ref.h"
-#include "components/signin/core/browser/child_account_info_fetcher.h"
 
 class AccountFetcherService;
 
-class ChildAccountInfoFetcherAndroid : public ChildAccountInfoFetcher {
+class ChildAccountInfoFetcherAndroid {
  public:
-  static std::unique_ptr<ChildAccountInfoFetcher> Create(
+  static std::unique_ptr<ChildAccountInfoFetcherAndroid> Create(
       AccountFetcherService* service,
       const std::string& account_id);
+  ~ChildAccountInfoFetcherAndroid();
 
   static void InitializeForTests();
 
@@ -25,9 +25,7 @@
   ChildAccountInfoFetcherAndroid(AccountFetcherService* service,
                                  const std::string& account_id,
                                  const std::string& account_name);
-  ~ChildAccountInfoFetcherAndroid() override;
 
- private:
   base::android::ScopedJavaGlobalRef<jobject> j_child_account_info_fetcher_;
 
   DISALLOW_COPY_AND_ASSIGN(ChildAccountInfoFetcherAndroid);
diff --git a/components/signin/core/browser/child_account_info_fetcher_impl.cc b/components/signin/core/browser/child_account_info_fetcher_impl.cc
deleted file mode 100644
index cc0fbf4e..0000000
--- a/components/signin/core/browser/child_account_info_fetcher_impl.cc
+++ /dev/null
@@ -1,181 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/signin/core/browser/child_account_info_fetcher_impl.h"
-
-#include "base/stl_util.h"
-#include "base/strings/string_split.h"
-#include "base/trace_event/trace_event.h"
-#include "base/values.h"
-#include "components/invalidation/public/invalidation_service.h"
-#include "components/invalidation/public/object_id_invalidation_map.h"
-#include "components/signin/core/browser/account_fetcher_service.h"
-#include "components/signin/core/browser/account_tracker_service.h"
-#include "components/signin/core/browser/signin_client.h"
-#include "google/cacheinvalidation/types.pb.h"
-#include "google_apis/gaia/gaia_auth_fetcher.h"
-#include "google_apis/gaia/gaia_constants.h"
-#include "services/network/public/cpp/shared_url_loader_factory.h"
-
-// TODO(maroun): Remove this file.
-
-namespace {
-
-const char kFetcherId[] = "ChildAccountInfoFetcherImpl";
-
-// Exponential backoff policy on service flag fetching failure.
-const net::BackoffEntry::Policy kBackoffPolicy = {
-  0,  // Number of initial errors to ignore without backoff.
-  2000,  // Initial delay for backoff in ms.
-  2,  // Factor to multiply waiting time by.
-  0.2,  // Fuzzing percentage. 20% will spread requests randomly between
-        // 80-100% of the calculated time.
-  1000 * 60 * 60* 4,  // Maximum time to delay requests by (4 hours).
-  -1,  // Don't discard entry even if unused.
-  false,  // Don't use the initial delay unless the last request was an error.
-};
-
-// The invalidation object ID used for child account graduation event.
-// The syntax is:
-// 'U' -> This is a user specific invalidation.
-// 'CA' -> Namespace used for all ChildAccount invalidations.
-// 'GRAD' -> Indicates the actual event i.e. child account graduation.
-const char kChildAccountGraduationId[] = "UCAGRAD";
-
-}  // namespace
-
-ChildAccountInfoFetcherImpl::ChildAccountInfoFetcherImpl(
-    const std::string& account_id,
-    AccountFetcherService* fetcher_service,
-    OAuth2TokenService* token_service,
-    scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
-    invalidation::InvalidationService* invalidation_service)
-    : OAuth2TokenService::Consumer(kFetcherId),
-      token_service_(token_service),
-      url_loader_factory_(url_loader_factory),
-      fetcher_service_(fetcher_service),
-      invalidation_service_(invalidation_service),
-      account_id_(account_id),
-      backoff_(&kBackoffPolicy),
-      fetch_in_progress_(false) {
-  TRACE_EVENT_ASYNC_BEGIN1("AccountFetcherService", kFetcherId, this,
-                           "account_id", account_id);
-  // Invalidation service may not be available in tests.
-  if (invalidation_service_) {
-    invalidation_service_->RegisterInvalidationHandler(this);
-    syncer::ObjectIdSet ids;
-    ids.insert(invalidation::ObjectId(
-        ipc::invalidation::ObjectSource::CHROME_COMPONENTS,
-        kChildAccountGraduationId));
-    bool insert_success =
-        invalidation_service_->UpdateRegisteredInvalidationIds(this, ids);
-    DCHECK(insert_success);
-  }
-  FetchIfNotInProgress();
-}
-
-ChildAccountInfoFetcherImpl::~ChildAccountInfoFetcherImpl() {
-  TRACE_EVENT_ASYNC_END0("AccountFetcherService", kFetcherId, this);
-  if (invalidation_service_)
-    UnregisterInvalidationHandler();
-}
-
-void ChildAccountInfoFetcherImpl::FetchIfNotInProgress() {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  if (fetch_in_progress_)
-    return;
-  fetch_in_progress_ = true;
-  OAuth2TokenService::ScopeSet scopes;
-  scopes.insert(GaiaConstants::kOAuth1LoginScope);
-  login_token_request_ =
-      token_service_->StartRequest(account_id_, scopes, this);
-}
-
-void ChildAccountInfoFetcherImpl::OnGetTokenSuccess(
-    const OAuth2TokenService::Request* request,
-    const OAuth2AccessTokenConsumer::TokenResponse& token_response) {
-  TRACE_EVENT_ASYNC_STEP_PAST0("AccountFetcherService", kFetcherId, this,
-                               "OnGetTokenSuccess");
-  DCHECK_EQ(request, login_token_request_.get());
-
-  gaia_auth_fetcher_ = fetcher_service_->signin_client_->CreateGaiaAuthFetcher(
-      this, gaia::GaiaSource::kChrome, url_loader_factory_);
-  gaia_auth_fetcher_->StartOAuthLogin(token_response.access_token,
-                                      GaiaConstants::kGaiaService);
-}
-
-void ChildAccountInfoFetcherImpl::OnGetTokenFailure(
-    const OAuth2TokenService::Request* request,
-    const GoogleServiceAuthError& error) {
-  HandleFailure();
-}
-
-void ChildAccountInfoFetcherImpl::OnClientLoginSuccess(
-    const ClientLoginResult& result) {
-  gaia_auth_fetcher_->StartGetUserInfo(result.lsid);
-}
-
-void ChildAccountInfoFetcherImpl::OnClientLoginFailure(
-    const GoogleServiceAuthError& error) {
-  HandleFailure();
-}
-
-void ChildAccountInfoFetcherImpl::OnGetUserInfoSuccess(
-    const UserInfoMap& data) {
-  auto services_iter = data.find("allServices");
-  if (services_iter != data.end()) {
-    std::vector<std::string> service_flags = base::SplitString(
-        services_iter->second, ",", base::TRIM_WHITESPACE,
-        base::SPLIT_WANT_ALL);
-    bool is_child_account = base::ContainsValue(
-        service_flags, AccountTrackerService::kChildAccountServiceFlag);
-    if (!is_child_account && invalidation_service_) {
-      // Don't bother listening for invalidations as a non-child account can't
-      // become a child account.
-      bool insert_success =
-          invalidation_service_->UpdateRegisteredInvalidationIds(
-              this, syncer::ObjectIdSet());
-      DCHECK(insert_success);
-      UnregisterInvalidationHandler();
-    }
-    fetcher_service_->SetIsChildAccount(account_id_, is_child_account);
-  } else {
-    DLOG(ERROR) << "ChildAccountInfoFetcherImpl::OnGetUserInfoSuccess: "
-                << "GetUserInfo response didn't include allServices field.";
-  }
-  fetch_in_progress_ = false;
-}
-
-void ChildAccountInfoFetcherImpl::OnGetUserInfoFailure(
-    const GoogleServiceAuthError& error) {
-  HandleFailure();
-}
-
-void ChildAccountInfoFetcherImpl::HandleFailure() {
-  fetch_in_progress_ = false;
-  backoff_.InformOfRequest(false);
-  timer_.Start(FROM_HERE, backoff_.GetTimeUntilRelease(), this,
-               &ChildAccountInfoFetcherImpl::FetchIfNotInProgress);
-}
-
-void ChildAccountInfoFetcherImpl::UnregisterInvalidationHandler() {
-  invalidation_service_->UnregisterInvalidationHandler(this);
-  invalidation_service_ = nullptr;
-}
-
-void ChildAccountInfoFetcherImpl::OnInvalidatorStateChange(
-    syncer::InvalidatorState state) {
-  if (state == syncer::INVALIDATOR_SHUTTING_DOWN)
-    UnregisterInvalidationHandler();
-}
-
-void ChildAccountInfoFetcherImpl::OnIncomingInvalidation(
-    const syncer::ObjectIdInvalidationMap& invalidation_map) {
-  FetchIfNotInProgress();
-  invalidation_map.AcknowledgeAll();
-}
-
-std::string ChildAccountInfoFetcherImpl::GetOwnerName() const {
-  return std::string(kFetcherId);
-}
diff --git a/components/signin/core/browser/child_account_info_fetcher_impl.h b/components/signin/core/browser/child_account_info_fetcher_impl.h
deleted file mode 100644
index e5383f6..0000000
--- a/components/signin/core/browser/child_account_info_fetcher_impl.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_SIGNIN_CORE_BROWSER_CHILD_ACCOUNT_INFO_FETCHER_IMPL_H_
-#define COMPONENTS_SIGNIN_CORE_BROWSER_CHILD_ACCOUNT_INFO_FETCHER_IMPL_H_
-
-#include <memory>
-
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/threading/thread_checker.h"
-#include "base/timer/timer.h"
-#include "components/invalidation/public/invalidation_handler.h"
-#include "components/signin/core/browser/child_account_info_fetcher.h"
-#include "google_apis/gaia/gaia_auth_consumer.h"
-#include "google_apis/gaia/oauth2_token_service.h"
-#include "net/base/backoff_entry.h"
-
-// TODO(maroun): Remove this file.
-
-namespace network {
-class SharedURLLoaderFactory;
-}
-
-class GaiaAuthFetcher;
-
-class ChildAccountInfoFetcherImpl : public ChildAccountInfoFetcher,
-                                    public OAuth2TokenService::Consumer,
-                                    public GaiaAuthConsumer,
-                                    public syncer::InvalidationHandler {
- public:
-  ChildAccountInfoFetcherImpl(
-      const std::string& account_id,
-      AccountFetcherService* fetcher_service,
-      OAuth2TokenService* token_service,
-      scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
-      invalidation::InvalidationService* invalidation_service);
-  ~ChildAccountInfoFetcherImpl() override;
-
- private:
-  void FetchIfNotInProgress();
-  void HandleFailure();
-  void UnregisterInvalidationHandler();
-
-  // OAuth2TokenService::Consumer:
-  void OnGetTokenSuccess(
-      const OAuth2TokenService::Request* request,
-      const OAuth2AccessTokenConsumer::TokenResponse& token_response) override;
-  void OnGetTokenFailure(const OAuth2TokenService::Request* request,
-                         const GoogleServiceAuthError& error) override;
-
-  // GaiaAuthConsumer:
-  void OnClientLoginSuccess(const ClientLoginResult& result) override;
-  void OnClientLoginFailure(const GoogleServiceAuthError& error) override;
-  void OnGetUserInfoSuccess(const UserInfoMap& data) override;
-  void OnGetUserInfoFailure(const GoogleServiceAuthError& error) override;
-
-  // syncer::InvalidationHandler:
-  void OnInvalidatorStateChange(syncer::InvalidatorState state) override;
-  void OnIncomingInvalidation(
-      const syncer::ObjectIdInvalidationMap& invalidation_map) override;
-  std::string GetOwnerName() const override;
-
-  OAuth2TokenService* token_service_;
-  scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
-  AccountFetcherService* fetcher_service_;
-  invalidation::InvalidationService* invalidation_service_;
-  const std::string account_id_;
-
-  // If fetching fails, retry with exponential backoff.
-  base::OneShotTimer timer_;
-  net::BackoffEntry backoff_;
-
-  std::unique_ptr<OAuth2TokenService::Request> login_token_request_;
-  std::unique_ptr<GaiaAuthFetcher> gaia_auth_fetcher_;
-
-  bool fetch_in_progress_;
-  base::ThreadChecker thread_checker_;
-
-  DISALLOW_COPY_AND_ASSIGN(ChildAccountInfoFetcherImpl);
-};
-
-#endif  // COMPONENTS_SIGNIN_CORE_BROWSER_CHILD_ACCOUNT_INFO_FETCHER_IMPL_H_
diff --git a/components/signin/core/browser/fake_account_fetcher_service.cc b/components/signin/core/browser/fake_account_fetcher_service.cc
index fde2c9e..c855b35 100644
--- a/components/signin/core/browser/fake_account_fetcher_service.cc
+++ b/components/signin/core/browser/fake_account_fetcher_service.cc
@@ -31,22 +31,11 @@
   account_tracker_service()->SetAccountInfoFromUserInfo(account_id, &user_info);
 }
 
-void FakeAccountFetcherService::FakeSetIsChildAccount(
-    const std::string& account_id,
-    bool is_child_account) {
-  SetIsChildAccount(account_id, is_child_account);
-}
-
 void FakeAccountFetcherService::StartFetchingUserInfo(
     const std::string& account_id) {
   // In tests, don't do actual network fetch.
 }
 
-void FakeAccountFetcherService::StartFetchingChildInfo(
-    const std::string& account_id) {
-  // In tests, don't do actual network fetch.
-}
-
 TestImageDecoder::TestImageDecoder() = default;
 
 TestImageDecoder::~TestImageDecoder() = default;
diff --git a/components/signin/core/browser/fake_account_fetcher_service.h b/components/signin/core/browser/fake_account_fetcher_service.h
index 5a3cafa2..9e1298f 100644
--- a/components/signin/core/browser/fake_account_fetcher_service.h
+++ b/components/signin/core/browser/fake_account_fetcher_service.h
@@ -33,14 +33,11 @@
                                 const std::string& given_name,
                                 const std::string& locale,
                                 const std::string& picture_url);
-  void FakeSetIsChildAccount(const std::string& account_id,
-                             bool is_child_account);
 
   FakeAccountFetcherService();
 
  private:
   void StartFetchingUserInfo(const std::string& account_id) override;
-  void StartFetchingChildInfo(const std::string& account_id) override;
 
   DISALLOW_COPY_AND_ASSIGN(FakeAccountFetcherService);
 };