Revert "Delete bind_interface_helpers.h"

This reverts commit a47f778447337af073d1fcf9ce62b237b738df50.

Reason for revert: breaks graphics on some Chrome OS devices.

Original change's description:
> Delete bind_interface_helpers.h
>
> This header provides a bunch of helper functions for Content processes
> modeled as Service Manager services. Since those are no longer a thing,
> this no longer needs to be a thing.
>
> Bug: 977637
> Change-Id: Ia1ae177b4a9665b727618b12a35be905d5605ce9
> Tbr: jam@chromium.org
> Tbr: erikchen@chromium.org
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1929396
> Commit-Queue: Ken Rockot <rockot@google.com>
> Reviewed-by: Ken Rockot <rockot@google.com>
> Cr-Commit-Position: refs/heads/master@{#718367}

Bug: 1028852
Bug: 977637
Tbr: rockot@google.com
Tbr: jam@chromium.org
Tbr: erikchen@chromium.org
Change-Id: Ie621804e4a6c03c26bf64130bab49f6a9380dea6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1948401
Reviewed-by: Shuhei Takahashi <nya@chromium.org>
Commit-Queue: Shuhei Takahashi <nya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#720918}
diff --git a/components/heap_profiling/client_connection_manager.cc b/components/heap_profiling/client_connection_manager.cc
index adf68be..5f51d9e9 100644
--- a/components/heap_profiling/client_connection_manager.cc
+++ b/components/heap_profiling/client_connection_manager.cc
@@ -20,6 +20,7 @@
 #include "content/public/browser/notification_service.h"
 #include "content/public/browser/notification_types.h"
 #include "content/public/browser/render_process_host.h"
+#include "content/public/common/bind_interface_helpers.h"
 #include "content/public/common/child_process_host.h"
 #include "content/public/common/process_type.h"
 #include "content/public/common/service_names.mojom.h"
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc
index bb814d7..b62500a0 100644
--- a/content/browser/gpu/gpu_process_host.cc
+++ b/content/browser/gpu/gpu_process_host.cc
@@ -51,6 +51,7 @@
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/content_browser_client.h"
 #include "content/public/browser/gpu_utils.h"
+#include "content/public/common/bind_interface_helpers.h"
 #include "content/public/common/content_client.h"
 #include "content/public/common/content_switches.h"
 #include "content/public/common/result_codes.h"
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index ef52b955..975a295 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -169,6 +169,7 @@
 #include "content/public/browser/site_isolation_policy.h"
 #include "content/public/browser/system_connector.h"
 #include "content/public/browser/webrtc_log.h"
+#include "content/public/common/bind_interface_helpers.h"
 #include "content/public/common/child_process_host.h"
 #include "content/public/common/content_client.h"
 #include "content/public/common/content_constants.h"
diff --git a/content/browser/tracing/background_tracing_manager_impl.cc b/content/browser/tracing/background_tracing_manager_impl.cc
index a10d3eb..ec974991 100644
--- a/content/browser/tracing/background_tracing_manager_impl.cc
+++ b/content/browser/tracing/background_tracing_manager_impl.cc
@@ -33,6 +33,7 @@
 #include "content/public/browser/content_browser_client.h"
 #include "content/public/browser/render_process_host.h"
 #include "content/public/browser/tracing_delegate.h"
+#include "content/public/common/bind_interface_helpers.h"
 #include "content/public/common/child_process_host.h"
 #include "content/public/common/content_client.h"
 #include "content/public/common/content_switches.h"
diff --git a/content/common/child_process_host_impl.cc b/content/common/child_process_host_impl.cc
index 5e397c7e..3954f15 100644
--- a/content/common/child_process_host_impl.cc
+++ b/content/common/child_process_host_impl.cc
@@ -22,6 +22,7 @@
 #include "base/synchronization/lock.h"
 #include "base/threading/thread_task_runner_handle.h"
 #include "build/build_config.h"
+#include "content/public/common/bind_interface_helpers.h"
 #include "content/public/common/child_process_host_delegate.h"
 #include "content/public/common/content_paths.h"
 #include "content/public/common/content_switches.h"
diff --git a/content/public/browser/render_process_host.h b/content/public/browser/render_process_host.h
index f0cd3ca..402b61aa 100644
--- a/content/public/browser/render_process_host.h
+++ b/content/public/browser/render_process_host.h
@@ -19,6 +19,7 @@
 #include "base/supports_user_data.h"
 #include "build/build_config.h"
 #include "content/common/content_export.h"
+#include "content/public/common/bind_interface_helpers.h"
 #include "ipc/ipc_channel_proxy.h"
 #include "ipc/ipc_sender.h"
 #include "media/media_buildflags.h"
diff --git a/content/public/common/BUILD.gn b/content/public/common/BUILD.gn
index 03ccb36f..17beffa8 100644
--- a/content/public/common/BUILD.gn
+++ b/content/public/common/BUILD.gn
@@ -114,6 +114,7 @@
   visibility = [ "//content/*" ]
 
   sources = [
+    "bind_interface_helpers.h",
     "bindings_policy.h",
     "browser_controls_state.h",
     "cdm_info.h",
diff --git a/content/public/common/bind_interface_helpers.h b/content/public/common/bind_interface_helpers.h
new file mode 100644
index 0000000..f4362d4
--- /dev/null
+++ b/content/public/common/bind_interface_helpers.h
@@ -0,0 +1,37 @@
+// Copyright 2014 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.
+
+#ifndef CONTENT_PUBLIC_COMMON_BIND_INTERFACE_HELPERS_H_
+#define CONTENT_PUBLIC_COMMON_BIND_INTERFACE_HELPERS_H_
+
+#include "mojo/public/cpp/bindings/interface_ptr.h"
+#include "mojo/public/cpp/bindings/interface_request.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/system/message_pipe.h"
+
+namespace content {
+
+template <typename Host, typename Interface>
+void BindInterface(Host* host, mojo::InterfacePtr<Interface>* ptr) {
+  mojo::MessagePipe pipe;
+  ptr->Bind(mojo::InterfacePtrInfo<Interface>(std::move(pipe.handle0), 0u));
+  host->BindInterface(Interface::Name_, std::move(pipe.handle1));
+}
+template <typename Host, typename Interface>
+void BindInterface(Host* host, mojo::InterfaceRequest<Interface> request) {
+  host->BindInterface(Interface::Name_, std::move(request.PassMessagePipe()));
+}
+template <typename Host, typename Interface>
+void BindInterface(Host* host, mojo::PendingRemote<Interface>* remote) {
+  auto receiver = remote->InitWithNewPipeAndPassReceiver();
+  host->BindInterface(Interface::Name_, receiver.PassPipe());
+}
+template <typename Host, typename Interface>
+void BindInterface(Host* host, mojo::PendingReceiver<Interface> receiver) {
+  host->BindInterface(Interface::Name_, receiver.PassPipe());
+}
+
+}  // namespace
+
+#endif  // CONTENT_PUBLIC_COMMON_BIND_INTERFACE_HELPERS_H_
diff --git a/content/public/common/child_process_host.h b/content/public/common/child_process_host.h
index 1f9802f2..8c3a44a 100644
--- a/content/public/common/child_process_host.h
+++ b/content/public/common/child_process_host.h
@@ -14,6 +14,7 @@
 #include "base/optional.h"
 #include "build/build_config.h"
 #include "content/common/content_export.h"
+#include "content/public/common/bind_interface_helpers.h"
 #include "ipc/ipc_channel_proxy.h"
 #include "mojo/public/cpp/bindings/generic_pending_receiver.h"
 #include "mojo/public/cpp/bindings/pending_receiver.h"
diff --git a/content/public/test/render_view_test.cc b/content/public/test/render_view_test.cc
index edd7111..5439d01 100644
--- a/content/public/test/render_view_test.cc
+++ b/content/public/test/render_view_test.cc
@@ -22,6 +22,7 @@
 #include "content/common/widget_messages.h"
 #include "content/public/browser/content_browser_client.h"
 #include "content/public/browser/native_web_keyboard_event.h"
+#include "content/public/common/bind_interface_helpers.h"
 #include "content/public/common/content_client.h"
 #include "content/public/common/content_switches.h"
 #include "content/public/common/previews_state.h"
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 6cd4d1b..8110e15 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -68,6 +68,7 @@
 #include "content/common/unfreezable_frame_messages.h"
 #include "content/common/view_messages.h"
 #include "content/common/web_package/signed_exchange_utils.h"
+#include "content/public/common/bind_interface_helpers.h"
 #include "content/public/common/bindings_policy.h"
 #include "content/public/common/content_constants.h"
 #include "content/public/common/content_features.h"