Create initial split of //components/signin into internals/externals

//components/signin/core/browser contains three different types of code:

1. Code that forms the guts of IdentityManager and will form the guts of
the Identity Service implementation (e.g., SigninManager).

2. Code that will be clients of IdentityManager (e.g., SigninTracker).

3. Code that will be used on both sides (e.g., AccountInfo).

Currently, all of these are naturally grouped in the same GN target,
since there was never any distinction between them. However, we need to
separate them in GN now to enable converting the code in 2 to use
IdentityManager. This split will also define the scope of the conversion
of the codebase to IdentityManager: everything that is in 1 will need to
have its clients converted to use IdentityManager.

This CL performs an initial split, via the following process:

- Moved signin_manager(_base).*, profile_oauth2_token_service.*, and
  account_tracker_service.* into a new "internals" target that the
  existing target now depends on.
- Kept moving in code (and adding dependencies as needed) until
  "gn check" no longer complained about the "internals" target including
  code that wasn't in any dependencies.

This CL also modifies //services/identity/public/cpp to depend only on
//components/signin/core/browser:internals; this change is is the
concrete benefit from doing the split, as it is what will allow us to
convert client code in //components/signin/core/browser.

Future CLs will refine the split, but this is a good initial checkpoint.

Bug: 901859
Change-Id: Ied46c4cdf0153b78b53516fec9537a83c4c0a71d
Reviewed-on: https://chromium-review.googlesource.com/c/1317915
Reviewed-by: Mihai Sardarescu <msarda@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605671}
diff --git a/components/signin/core/browser/BUILD.gn b/components/signin/core/browser/BUILD.gn
index d60dd80..51af6b1 100644
--- a/components/signin/core/browser/BUILD.gn
+++ b/components/signin/core/browser/BUILD.gn
@@ -45,6 +45,60 @@
   ]
 }
 
+# This target contains what will become the core of the Identity Service
+# implementation. It currently forms the core of the IdentityManager
+# implementation (//services/identity/public/cpp/identity_manager.*). We are
+# actively converting the codebase away from using the code in this target
+# directly to using IdentityManager (tracked in https://crbug.com/796544). Do
+# not add code to this target without consulting with blundell@chromium.org.
+static_library("internals") {
+  sources = [
+    "account_tracker_service.cc",
+    "account_tracker_service.h",
+    "device_id_helper.cc",
+    "device_id_helper.h",
+    "gaia_cookie_manager_service.cc",
+    "gaia_cookie_manager_service.h",
+    "profile_management_switches.cc",
+    "profile_management_switches.h",
+    "profile_oauth2_token_service.cc",
+    "profile_oauth2_token_service.h",
+    "signin_client.cc",
+    "signin_client.h",
+    "signin_error_controller.cc",
+    "signin_error_controller.h",
+    "signin_internals_util.cc",
+    "signin_internals_util.h",
+    "signin_manager.cc",
+    "signin_manager.h",
+    "signin_manager_base.cc",
+    "signin_manager_base.h",
+    "signin_pref_names.cc",
+    "signin_pref_names.h",
+    "signin_switches.cc",
+    "signin_switches.h",
+  ]
+
+  if (is_chromeos) {
+    sources -= [ "signin_manager.cc" ]
+  }
+
+  deps = [
+    ":account_info",
+    ":signin_buildflags",
+    ":signin_metrics",
+    "//base",
+    "//components/data_use_measurement/core",
+    "//components/keyed_service/core",
+    "//components/prefs",
+    "//google_apis",
+    "//net",
+    "//services/network/public/cpp",
+    "//services/network/public/mojom",
+    "//ui/gfx",
+  ]
+}
+
 static_library("browser") {
   sources = [
     "about_signin_internals.cc",
@@ -59,8 +113,6 @@
     "account_reconcilor.h",
     "account_reconcilor_delegate.cc",
     "account_reconcilor_delegate.h",
-    "account_tracker_service.cc",
-    "account_tracker_service.h",
     "avatar_icon_util.cc",
     "avatar_icon_util.h",
     "child_account_info_fetcher.cc",
@@ -73,44 +125,22 @@
     "chrome_connected_header_helper.h",
     "cookie_settings_util.cc",
     "cookie_settings_util.h",
-    "device_id_helper.cc",
-    "device_id_helper.h",
     "dice_account_reconcilor_delegate.cc",
     "dice_account_reconcilor_delegate.h",
     "dice_header_helper.cc",
     "dice_header_helper.h",
-    "gaia_cookie_manager_service.cc",
-    "gaia_cookie_manager_service.h",
     "mirror_account_reconcilor_delegate.cc",
     "mirror_account_reconcilor_delegate.h",
-    "profile_management_switches.cc",
-    "profile_management_switches.h",
-    "profile_oauth2_token_service.cc",
-    "profile_oauth2_token_service.h",
-    "signin_client.cc",
-    "signin_client.h",
-    "signin_error_controller.cc",
-    "signin_error_controller.h",
     "signin_header_helper.cc",
     "signin_header_helper.h",
-    "signin_internals_util.cc",
-    "signin_internals_util.h",
     "signin_investigator.cc",
     "signin_investigator.h",
-    "signin_manager.cc",
-    "signin_manager.h",
-    "signin_manager_base.cc",
-    "signin_manager_base.h",
-    "signin_pref_names.cc",
-    "signin_pref_names.h",
     "signin_status_metrics_provider.cc",
     "signin_status_metrics_provider.h",
     "signin_status_metrics_provider_base.cc",
     "signin_status_metrics_provider_base.h",
     "signin_status_metrics_provider_delegate.cc",
     "signin_status_metrics_provider_delegate.h",
-    "signin_switches.cc",
-    "signin_switches.h",
     "signin_tracker.cc",
     "signin_tracker.h",
     "webdata/token_service_table.cc",
@@ -123,6 +153,7 @@
 
   public_deps = [
     ":account_info",
+    ":internals",
     ":signin_buildflags",
     ":signin_metrics",
     "//base",
@@ -156,7 +187,6 @@
 
   if (is_chromeos) {
     sources -= [
-      "signin_manager.cc",
       "signin_status_metrics_provider.cc",
       "signin_status_metrics_provider_delegate.cc",
     ]
diff --git a/services/identity/public/cpp/BUILD.gn b/services/identity/public/cpp/BUILD.gn
index 72feb6e..7c3ab1c 100644
--- a/services/identity/public/cpp/BUILD.gn
+++ b/services/identity/public/cpp/BUILD.gn
@@ -25,8 +25,11 @@
   configs += [ "//build/config/compiler:wexit_time_destructors" ]
 
   public_deps = [
-    "//components/signin/core/browser",
+    "//components/signin/core/browser:account_info",
+    "//components/signin/core/browser:internals",
+    "//components/signin/core/browser:signin_metrics",
     "//services/identity/public/cpp:cpp_types",
+    "//services/network/public/cpp",
   ]
 }