Route conversion registration requests from blink to ConversionStorage

This change implements a conversion registration flow for the Event Level
Conversion Measurement API.

A request is considered a conversion registration if it redirects to
/.well-known/register-conversion. This request is blocked in
frame_fetch_context and sent via a NavigationAssociatedInterface to
ConversionManager and logged to storage.

Design doc(RVG): https://crbug.com/1039466
Explainer: https://github.com/csharrison/conversion-measurement-api

Bug: 1042923
Change-Id: If0398a662f68cc6092922c79ba05f546bf0562e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1998977
Commit-Queue: John Delaney <[email protected]>
Reviewed-by: Charlie Harrison <[email protected]>
Reviewed-by: Avi Drissman <[email protected]>
Reviewed-by: Mike West <[email protected]>
Cr-Commit-Position: refs/heads/master@{#739602}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 61519dfd..975a63c 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -48,6 +48,7 @@
 #include "content/browser/browser_plugin/browser_plugin_embedder.h"
 #include "content/browser/browser_plugin/browser_plugin_guest.h"
 #include "content/browser/child_process_security_policy_impl.h"
+#include "content/browser/conversions/conversion_host.h"
 #include "content/browser/devtools/protocol/page_handler.h"
 #include "content/browser/devtools/render_frame_devtools_agent_host.h"
 #include "content/browser/display_cutout/display_cutout_host_impl.h"
@@ -601,6 +602,10 @@
 #if defined(OS_ANDROID)
   display_cutout_host_impl_ = std::make_unique<DisplayCutoutHostImpl>(this);
 #endif
+
+  // ConversionHost takes a weak ref on |this|, so it must be created outside of
+  // the initializer list.
+  conversion_host_ = std::make_unique<ConversionHost>(this);
 }
 
 WebContentsImpl::~WebContentsImpl() {
@@ -1223,6 +1228,11 @@
   return it->second;
 }
 
+void WebContentsImpl::RemoveReceiverSetForTesting(
+    const std::string& interface_name) {
+  RemoveReceiverSet(interface_name);
+}
+
 std::vector<WebContentsImpl*> WebContentsImpl::GetWebContentsAndAllInner() {
   std::vector<WebContentsImpl*> all_contents(1, this);