[SSL] Componentize SSLErrorHandler and CaptivePortalHelper

This CL componentizes SSLErrorHandler for sharing with WebLayer. The
componentization must be done together with that of CaptivePortalHelper
as the two have a mutual dependency. After a *long* chain of leadup
CLs, the actual componentization is now straightforward.

\o/

NOPRESUBMIT=true

Bug: 1030692
Change-Id: Idf572bfb45db2e4958028a9f361fa9498dc792f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2022708
Commit-Queue: Colin Blundell <[email protected]>
Reviewed-by: Carlos IL <[email protected]>
Cr-Commit-Position: refs/heads/master@{#735830}
diff --git a/components/security_interstitials/content/BUILD.gn b/components/security_interstitials/content/BUILD.gn
index 009a4d6..ea7d72a 100644
--- a/components/security_interstitials/content/BUILD.gn
+++ b/components/security_interstitials/content/BUILD.gn
@@ -1,6 +1,7 @@
 # Copyright 2016 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.
+import("//components/captive_portal/core/features.gni")
 import("//third_party/protobuf/proto_library.gni")
 
 static_library("security_interstitial_page") {
@@ -11,6 +12,10 @@
     "blocked_interception_blocking_page.h",
     "captive_portal_blocking_page.cc",
     "captive_portal_blocking_page.h",
+    "captive_portal_helper.h",
+    "captive_portal_helper_android.cc",
+    "captive_portal_helper_android.h",
+    "captive_portal_helper_win.cc",
     "cert_report_helper.cc",
     "cert_report_helper.h",
     "certificate_error_report.cc",
@@ -41,6 +46,8 @@
     "ssl_cert_reporter.h",
     "ssl_error_assistant.cc",
     "ssl_error_assistant.h",
+    "ssl_error_handler.cc",
+    "ssl_error_handler.h",
     "ssl_error_navigation_throttle.cc",
     "ssl_error_navigation_throttle.h",
     "unsafe_resource_util.cc",
@@ -49,7 +56,10 @@
     "urls.h",
   ]
 
-  public_deps = [ "//components/safe_browsing/core/db:hit_report" ]
+  public_deps = [
+    "//components/captive_portal/core:buildflags",
+    "//components/safe_browsing/core/db:hit_report",
+  ]
 
   deps = [
     ":proto",
@@ -76,9 +86,18 @@
     "//third_party/re2",
   ]
 
+  if (enable_captive_portal_detection) {
+    deps += [ "//components/captive_portal/content" ]
+  }
+
   if (is_win || is_mac) {
     deps += [ "//components/wifi" ]
   }
+
+  if (is_android) {
+    deps +=
+        [ "//components/security_interstitials/content/android:jni_headers" ]
+  }
 }
 
 proto_library("proto") {