[iOS/GN] Fix and enable "gn check" for "//ios/*" and "//ios_internal/*".

Add missing dependencies, add circular include exception for targets that
are conceptually a single target but split for practical reason, move some
files and remove obsolete includes to fix "gn check".

Enable "gn check" for "//ios/*" and "//ios_internal/*".

[email protected]
[email protected]
BUG=None

Committed: https://crrev.com/9852b77afa1a1b3875a73a091e94f88865c4e78e
Cr-Commit-Position: refs/heads/master@{#394428}

Review-Url: https://codereview.chromium.org/1984353002
Cr-Commit-Position: refs/heads/master@{#394503}
diff --git a/ios/chrome/browser/BUILD.gn b/ios/chrome/browser/BUILD.gn
index dc18113..7de239c 100644
--- a/ios/chrome/browser/BUILD.gn
+++ b/ios/chrome/browser/BUILD.gn
@@ -163,6 +163,7 @@
     "geolocation/CLLocation+OmniboxGeolocation.mm",
     "geolocation/CLLocation+XGeoHeader.h",
     "geolocation/CLLocation+XGeoHeader.mm",
+    "geolocation/location_manager+Testing.h",
     "geolocation/location_manager.h",
     "geolocation/location_manager.mm",
     "geolocation/omnibox_geolocation_authorization_alert.h",
@@ -541,6 +542,7 @@
     ":about_flags",
     ":injected_js",
     "//base",
+    "//base:i18n",
     "//breakpad:client",
     "//components/about_handler",
     "//components/autofill/core/browser",
@@ -553,13 +555,16 @@
     "//components/certificate_reporting",
     "//components/component_updater",
     "//components/content_settings/core/browser",
+    "//components/content_settings/core/common",
     "//components/cookie_config",
     "//components/crash/core/browser",
     "//components/crash/core/common",
+    "//components/data_reduction_proxy/core/common",
     "//components/dom_distiller/core",
     "//components/dom_distiller/ios",
     "//components/favicon/core",
     "//components/favicon_base",
+    "//components/flags_ui",
     "//components/gcm_driver",
     "//components/google/core/browser",
     "//components/history/core/browser",
@@ -585,6 +590,7 @@
     "//components/omnibox/browser",
     "//components/open_from_clipboard",
     "//components/password_manager/core/browser",
+    "//components/password_manager/core/common",
     "//components/password_manager/sync/browser",
     "//components/policy:policy_component_common",
     "//components/pref_registry",
@@ -608,6 +614,7 @@
     "//components/sync_sessions",
     "//components/syncable_prefs",
     "//components/translate/core/browser",
+    "//components/translate/core/common",
     "//components/translate/ios/browser",
     "//components/undo",
     "//components/update_client",
@@ -624,8 +631,13 @@
     "//google_apis",
     "//ios/chrome/browser/variations:ios_chrome_ui_string_overrider_factory",
     "//ios/chrome/common",
+    "//ios/chrome/common/app_group",
+    "//ios/net",
     "//ios/public/provider/chrome/browser",
+    "//ios/public/provider/web",
     "//ios/web",
+    "//ios/web:user_agent",
+    "//ios/web/public/app",
     "//net",
     "//net:extras",
     "//skia",
@@ -633,6 +645,8 @@
     "//third_party/google_toolbox_for_mac",
     "//ui/base",
     "//ui/gfx",
+    "//ui/resources",
+    "//ui/strings",
     "//url",
 
     # TODO(crbug.com/459705): add support for resource packing and change the
@@ -642,6 +656,8 @@
     "//ios/chrome/app/theme",
   ]
 
+  allow_circular_includes_from = [ ":about_flags" ]
+
   libs = [
     "Accelerate.framework",
     "CoreGraphics.framework",
@@ -652,9 +668,14 @@
   ]
 
   if (enable_rlz) {
+    sources += [
+      "rlz/rlz_tracker_delegate_impl.cc",
+      "rlz/rlz_tracker_delegate_impl.h",
+    ]
+
     deps += [
-      ":rlz",
       "//components/rlz",
+      "//rlz:rlz_lib",
     ]
   }
 }
@@ -675,10 +696,14 @@
     "//components/autofill/core/common",
     "//components/dom_distiller/core",
     "//components/flags_ui",
+    "//components/flags_ui:switches",
     "//components/strings",
+    "//components/sync_driver",
+    "//components/variations",
     "//google_apis",
     "//ios/chrome/app/strings",
     "//ios/web",
+    "//ios/web:user_agent",
   ]
 
   defines = [
@@ -702,23 +727,6 @@
   ]
 }
 
-if (enable_rlz_support) {
-  source_set("rlz") {
-    sources = [
-      "rlz/rlz_tracker_delegate_impl.cc",
-      "rlz/rlz_tracker_delegate_impl.h",
-    ]
-
-    deps = [
-      "//components/google/core/browser",
-      "//components/omnibox/browser",
-      "//components/rlz",
-      "//components/search_engines",
-      "//rlz:rlz_lib",
-    ]
-  }
-}
-
 source_set("test_support") {
   testonly = true
   sources = [
@@ -726,7 +734,6 @@
     "browser_state/test_chrome_browser_state.mm",
     "browser_state/test_chrome_browser_state_isolated_context.h",
     "browser_state/test_chrome_browser_state_isolated_context.mm",
-    "geolocation/location_manager+Testing.h",
     "geolocation/test_location_manager.h",
     "geolocation/test_location_manager.mm",
     "net/mock_image_fetcher.h",
@@ -746,20 +753,32 @@
   deps = [
     ":browser",
     "//base",
+    "//components/bookmarks/browser",
+    "//components/browser_sync/browser",
     "//components/browser_sync/browser:test_support",
+    "//components/history/core/browser",
+    "//components/history/ios/browser",
     "//components/keyed_service/core",
     "//components/keyed_service/ios",
     "//components/pref_registry:test_support",
     "//components/signin/core/browser",
+    "//components/signin/core/browser",
+    "//components/signin/core/browser:test_support",
     "//components/signin/ios/browser",
+    "//components/signin/ios/browser:test_support",
     "//components/sync_driver",
     "//components/sync_driver:test_support",
+    "//components/syncable_prefs",
+    "//components/syncable_prefs:test_support",
+    "//components/user_prefs",
+    "//components/webdata_services",
     "//ios/chrome/browser",
     "//ios/chrome/common",
     "//ios/chrome/test",
     "//ios/public/provider/chrome/browser",
     "//ios/public/provider/chrome/browser:test_support",
     "//ios/web",
+    "//net:test_support",
     "//sync",
     "//testing/gmock",
     "//testing/gtest",