Convert startup_metric_utils to use mojo.

BUG=577685
[email protected]

Committed: https://crrev.com/089f995b33d52e072a1a00c0302116fb9d4e49fb
Review-Url: https://codereview.chromium.org/2022413002
Cr-Original-Commit-Position: refs/heads/master@{#398781}
Cr-Commit-Position: refs/heads/master@{#398831}
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index d4ceb56..4eb706ea 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -175,8 +175,8 @@
     "//components/security_state",
     "//components/signin/core/browser",
     "//components/ssl_errors",
+    "//components/startup_metric_utils/browser:host",
     "//components/startup_metric_utils/browser:lib",
-    "//components/startup_metric_utils/browser:message_filter_lib",
 
     # TODO(fdoray): Remove this once the PreRead field trial has expired.
     # crbug.com/577698
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 9baf8b4..710f5b5 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -130,7 +130,7 @@
 #include "components/rappor/rappor_utils.h"
 #include "components/security_interstitials/core/ssl_error_ui.h"
 #include "components/signin/core/common/profile_management_switches.h"
-#include "components/startup_metric_utils/browser/startup_metric_message_filter.h"
+#include "components/startup_metric_utils/browser/startup_metric_host_impl.h"
 #include "components/translate/core/common/translate_switches.h"
 #include "components/url_formatter/url_fixer.h"
 #include "components/variations/variations_associated_data.h"
@@ -993,7 +993,6 @@
       DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile);
   host->AddFilter(new data_reduction_proxy::DataReductionProxyMessageFilter(
       data_reduction_proxy_settings));
-  host->AddFilter(new startup_metric_utils::StartupMetricMessageFilter());
 
   host->GetImmediateSender()->Send(new ChromeViewMsg_SetIsIncognitoProcess(
       profile->IsOffTheRecord()));
@@ -2719,6 +2718,12 @@
 }
 #endif  // defined(OS_WIN)
 
+void ChromeContentBrowserClient::RegisterRenderProcessMojoServices(
+    content::ServiceRegistry* registry) {
+  registry->AddService(
+      base::Bind(&startup_metric_utils::StartupMetricHostImpl::Create));
+}
+
 void ChromeContentBrowserClient::RegisterFrameMojoShellServices(
     content::ServiceRegistry* registry,
     content::RenderFrameHost* render_frame_host) {
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h
index 02e4a33d..0fb8262 100644
--- a/chrome/browser/chrome_content_browser_client.h
+++ b/chrome/browser/chrome_content_browser_client.h
@@ -272,6 +272,8 @@
       const std::string& mime_type) const override;
   bool ShouldUseWindowsPrefetchArgument() const override;
 #endif
+  void RegisterRenderProcessMojoServices(
+      content::ServiceRegistry* registry) override;
   void RegisterFrameMojoShellServices(
       content::ServiceRegistry* registry,
       content::RenderFrameHost* render_frame_host) override;