Clean up CSPCheckResult::AllowedOnlyIfWildcardMatchesFtp

Cleaning up unnecessary code after https://crrev.com/c/6085869 lands.

Change-Id: I4d6d90209bf5d942f10bc9319e90ae98edf0167c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6089290
Commit-Queue: Nathan Memmott <memmott@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1394956}
diff --git a/chrome/browser/chrome_web_platform_security_metrics_browsertest.cc b/chrome/browser/chrome_web_platform_security_metrics_browsertest.cc
index 4930ea6..b05cb127 100644
--- a/chrome/browser/chrome_web_platform_security_metrics_browsertest.cc
+++ b/chrome/browser/chrome_web_platform_security_metrics_browsertest.cc
@@ -612,25 +612,16 @@
     const char* csp_frame_src;
     const char* sub_document_url;
     int expected_kCspWouldBlockIfWildcardDoesNotMatchWs;
-    int expected_kCspWouldBlockIfWildcardDoesNotMatchFtp;
   } test_cases[] = {
-      {"*", "http://example.com", 0, 0},
+      {"*", "http://example.com", 0},
       // Feature shouldn't be logged if matches explicitly.
-      {"ftp:*", "ftp://example.com", 0, 0},
-      {"ws:*", "ws://example.com", 0, 0},
-      {"wss:*", "wss://example.com", 0, 0},
-      // Feature should be logged if matched with wildcard.
-      {
-          "*",
-          "ftp://example.com",
-          0,
-          0,
-      },
-      {"*", "ws://example.com", 1, 0},
-      {"*", "wss://example.com", 1, 0},
+      {"ftp:*", "ftp://example.com", 0},
+      {"ws:*", "ws://example.com", 0},
+      {"wss:*", "wss://example.com", 0},
+      {"*", "ws://example.com", 1},
+      {"*", "wss://example.com", 1},
   };
   int total_kCspWouldBlockIfWildcardDoesNotMatchWs = 0;
-  int total_kCspWouldBlockIfWildcardDoesNotMatchFtp = 0;
   for (const auto& test_case : test_cases) {
     GURL main_document_url = https_server().GetURL(
         "a.com",
@@ -653,9 +644,6 @@
     CheckCounter(WebFeature::kCspWouldBlockIfWildcardDoesNotMatchWs,
                  total_kCspWouldBlockIfWildcardDoesNotMatchWs +=
                  test_case.expected_kCspWouldBlockIfWildcardDoesNotMatchWs);
-    CheckCounter(WebFeature::kCspWouldBlockIfWildcardDoesNotMatchFtp,
-                 total_kCspWouldBlockIfWildcardDoesNotMatchFtp +=
-                 test_case.expected_kCspWouldBlockIfWildcardDoesNotMatchFtp);
   }
 }
 
diff --git a/content/browser/renderer_host/ancestor_throttle.cc b/content/browser/renderer_host/ancestor_throttle.cc
index 2cfc962..11c22e1 100644
--- a/content/browser/renderer_host/ancestor_throttle.cc
+++ b/content/browser/renderer_host/ancestor_throttle.cc
@@ -375,11 +375,6 @@
           parent,
           blink::mojom::WebFeature::kCspWouldBlockIfWildcardDoesNotMatchWs);
     }
-    if (result.WouldBlockIfWildcardDoesNotMatchFtp()) {
-      GetContentClient()->browser()->LogWebFeatureForCurrentPage(
-          parent,
-          blink::mojom::WebFeature::kCspWouldBlockIfWildcardDoesNotMatchFtp);
-    }
     if (!result) {
       return CheckResult::BLOCK;
     }
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc
index bc26c94..c09ab1e 100644
--- a/content/browser/renderer_host/navigation_request.cc
+++ b/content/browser/renderer_host/navigation_request.cc
@@ -6727,11 +6727,6 @@
         GetParentFrame(),
         blink::mojom::WebFeature::kCspWouldBlockIfWildcardDoesNotMatchWs);
   }
-  if (result.WouldBlockIfWildcardDoesNotMatchFtp()) {
-    GetContentClient()->browser()->LogWebFeatureForCurrentPage(
-        GetParentFrame(),
-        blink::mojom::WebFeature::kCspWouldBlockIfWildcardDoesNotMatchFtp);
-  }
   return result.IsAllowed();
 }
 
diff --git a/services/network/public/cpp/content_security_policy/content_security_policy.cc b/services/network/public/cpp/content_security_policy/content_security_policy.cc
index a571ad66..e4f67cbbd 100644
--- a/services/network/public/cpp/content_security_policy/content_security_policy.cc
+++ b/services/network/public/cpp/content_security_policy/content_security_policy.cc
@@ -1128,23 +1128,19 @@
 }  // namespace
 
 CSPCheckResult::CSPCheckResult(bool allowed)
-    : CSPCheckResult(allowed, allowed, allowed) {}
+    : CSPCheckResult(allowed, allowed) {}
 
 CSPCheckResult& CSPCheckResult::operator&=(const CSPCheckResult& other) {
   allowed_ &= other.allowed_;
   allowed_if_wildcard_does_not_match_ws_ &=
       other.allowed_if_wildcard_does_not_match_ws_;
-  allowed_if_wildcard_does_not_match_ftp_ &=
-      other.allowed_if_wildcard_does_not_match_ftp_;
   return *this;
 }
 
 bool CSPCheckResult::operator==(const CSPCheckResult& other) const {
   return allowed_ == other.allowed_ &&
          allowed_if_wildcard_does_not_match_ws_ ==
-             other.allowed_if_wildcard_does_not_match_ws_ &&
-         allowed_if_wildcard_does_not_match_ftp_ ==
-             other.allowed_if_wildcard_does_not_match_ftp_;
+             other.allowed_if_wildcard_does_not_match_ws_;
 }
 
 CSPCheckResult::operator bool() const {
@@ -1160,33 +1156,22 @@
 }
 
 CSPCheckResult CSPCheckResult::AllowedOnlyIfWildcardMatchesWs() {
-  return CSPCheckResult(true, false, true);
-}
-
-CSPCheckResult CSPCheckResult::AllowedOnlyIfWildcardMatchesFtp() {
-  return CSPCheckResult(true, true, false);
+  return CSPCheckResult(true, false);
 }
 
 bool CSPCheckResult::WouldBlockIfWildcardDoesNotMatchWs() const {
   return allowed_ != allowed_if_wildcard_does_not_match_ws_;
 }
 
-bool CSPCheckResult::WouldBlockIfWildcardDoesNotMatchFtp() const {
-  return allowed_ != allowed_if_wildcard_does_not_match_ftp_;
-}
-
 bool CSPCheckResult::IsAllowed() const {
   return allowed_;
 }
 
 CSPCheckResult::CSPCheckResult(bool allowed,
-                               bool allowed_if_wildcard_does_not_match_ws,
-                               bool allowed_if_wildcard_does_not_match_ftp)
+                               bool allowed_if_wildcard_does_not_match_ws)
     : allowed_(allowed),
       allowed_if_wildcard_does_not_match_ws_(
-          allowed_if_wildcard_does_not_match_ws),
-      allowed_if_wildcard_does_not_match_ftp_(
-          allowed_if_wildcard_does_not_match_ftp) {}
+          allowed_if_wildcard_does_not_match_ws) {}
 
 CSPDirectiveName CSPFallbackDirective(CSPDirectiveName directive,
                                       CSPDirectiveName original_directive) {
diff --git a/services/network/public/cpp/content_security_policy/content_security_policy.h b/services/network/public/cpp/content_security_policy/content_security_policy.h
index 36f9e2a..dee7944 100644
--- a/services/network/public/cpp/content_security_policy/content_security_policy.h
+++ b/services/network/public/cpp/content_security_policy/content_security_policy.h
@@ -24,8 +24,7 @@
 class CSPContext;
 
 // The field |allowed_if_wildcard_does_not_match_ws| is the result assuming '*'
-// doesn't match ws or wss, and |allowed_if_wildcard_does_not_match_ftp| is the
-// result assuming '*' doesn't match ftp. These two are only for logging.
+// doesn't match ws or wss. It is only for logging.
 class COMPONENT_EXPORT(NETWORK_CPP) CSPCheckResult {
  public:
   explicit CSPCheckResult(bool);
@@ -39,21 +38,17 @@
   static CSPCheckResult Allowed();
   static CSPCheckResult Blocked();
   static CSPCheckResult AllowedOnlyIfWildcardMatchesWs();
-  static CSPCheckResult AllowedOnlyIfWildcardMatchesFtp();
 
   bool WouldBlockIfWildcardDoesNotMatchWs() const;
-  bool WouldBlockIfWildcardDoesNotMatchFtp() const;
 
   bool IsAllowed() const;
 
  private:
   CSPCheckResult(bool allowed,
-                 bool allowed_if_wildcard_does_not_match_ws,
-                 bool allowed_if_wildcard_does_not_match_ftp);
+                 bool allowed_if_wildcard_does_not_match_ws);
 
   bool allowed_;
   bool allowed_if_wildcard_does_not_match_ws_;
-  bool allowed_if_wildcard_does_not_match_ftp_;
 };
 
 // Return the next Content Security Policy directive after |directive| in
diff --git a/third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom b/third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom
index 9fb3ab91..ca40c7b 100644
--- a/third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom
+++ b/third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom
@@ -4054,7 +4054,7 @@
   kV8ClipboardItem_Supports_Method = 4692,
   kThirdPartyCookieAccessBlockByExperiment = 4693,
   kCspWouldBlockIfWildcardDoesNotMatchWs = 4694,
-  kCspWouldBlockIfWildcardDoesNotMatchFtp = 4695,
+  kOBSOLETE_CspWouldBlockIfWildcardDoesNotMatchFtp = 4695,
   kStorageAccessAPI_requestStorageAccess_BeyondCookies = 4696,
   kStorageAccessAPI_requestStorageAccess_BeyondCookies_all = 4697,
   kStorageAccessAPI_requestStorageAccess_BeyondCookies_sessionStorage = 4698,
diff --git a/third_party/blink/renderer/core/frame/csp/content_security_policy.cc b/third_party/blink/renderer/core/frame/csp/content_security_policy.cc
index f44dbe70..826cd4d 100644
--- a/third_party/blink/renderer/core/frame/csp/content_security_policy.cc
+++ b/third_party/blink/renderer/core/frame/csp/content_security_policy.cc
@@ -938,9 +938,6 @@
   if (result.WouldBlockIfWildcardDoesNotMatchWs()) {
     Count(WebFeature::kCspWouldBlockIfWildcardDoesNotMatchWs);
   }
-  if (result.WouldBlockIfWildcardDoesNotMatchFtp()) {
-    Count(WebFeature::kCspWouldBlockIfWildcardDoesNotMatchFtp);
-  }
 
   return result.IsAllowed();
 }
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml
index 483dcafe..a25f56e 100644
--- a/tools/metrics/histograms/enums.xml
+++ b/tools/metrics/histograms/enums.xml
@@ -10330,7 +10330,7 @@
   <int value="4692" label="V8ClipboardItem_Supports_Method"/>
   <int value="4693" label="ThirdPartyCookieAccessBlockByExperiment"/>
   <int value="4694" label="CspWouldBlockIfWildcardDoesNotMatchWs"/>
-  <int value="4695" label="CspWouldBlockIfWildcardDoesNotMatchFtp"/>
+  <int value="4695" label="OBSOLETE_CspWouldBlockIfWildcardDoesNotMatchFtp"/>
   <int value="4696"
       label="StorageAccessAPI_requestStorageAccess_BeyondCookies"/>
   <int value="4697"