[Android] Add enable_chrome_android_internal GN flag

This flag will allow devs having access to the internal Chrome for
Android repo to choose whether to use it in their builds.

BUG=702323

Review-Url: https://codereview.chromium.org/2753273002
Cr-Commit-Position: refs/heads/master@{#457749}
diff --git a/BUILD.gn b/BUILD.gn
index 8f84ca3..4ecf89c 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -322,7 +322,7 @@
       ]
     }
 
-    if (has_chrome_android_internal) {
+    if (enable_chrome_android_internal) {
       deps += [ "//clank" ]
     }
   }
diff --git a/build/config/android/config.gni b/build/config/android/config.gni
index 2f68c89..a9ff7c4 100644
--- a/build/config/android/config.gni
+++ b/build/config/android/config.gni
@@ -12,7 +12,19 @@
                   [ rebase_path("//clank", root_build_dir) ],
                   "string") == "True"
 
-  if (has_chrome_android_internal) {
+  # We are using a separate declare_args block for only this argument so that
+  # we can decide if we have to pull in definitions from the internal config
+  # early.
+  declare_args() {
+    # Enables using the internal Chrome for Android repository. The default
+    # value depends on whether the repository is available, and if it's not but
+    # this argument is manually set to True, the generation will fail.
+    # The main purpose of this argument is to avoid having to maintain 2
+    # repositories to support both public only and internal builds.
+    enable_chrome_android_internal = has_chrome_android_internal
+  }
+
+  if (enable_chrome_android_internal) {
     import("//clank/config.gni")
   }