Clean up old Mojo types for mojom::DebugLogsChangeHandler

This CL cleans up old Mojo types for mojom::DebugLogsChangeHandler
using PendingRemote and ReceiverSet instead of InterfacePtr
and BindingSet.

Bug: 955171
Change-Id: Iffb8cb730857f8b5ea417300f0e8b9235c88ed97
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1939070
Reviewed-by: Sam McNally <sammc@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Ryan Hansberry <hansberry@chromium.org>
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Commit-Queue: Julie Kim <jkim@igalia.com>
Cr-Commit-Position: refs/heads/master@{#720821}
diff --git a/chrome/browser/chromeos/bluetooth/debug_logs_manager.cc b/chrome/browser/chromeos/bluetooth/debug_logs_manager.cc
index 6727f3f..eb11726 100644
--- a/chrome/browser/chromeos/bluetooth/debug_logs_manager.cc
+++ b/chrome/browser/chromeos/bluetooth/debug_logs_manager.cc
@@ -39,10 +39,11 @@
              : DebugLogsState::kSupportedButDisabled;
 }
 
-mojom::DebugLogsChangeHandlerPtr DebugLogsManager::GenerateInterfacePtr() {
-  mojom::DebugLogsChangeHandlerPtr interface_ptr;
-  bindings_.AddBinding(this, mojo::MakeRequest(&interface_ptr));
-  return interface_ptr;
+mojo::PendingRemote<mojom::DebugLogsChangeHandler>
+DebugLogsManager::GenerateRemote() {
+  mojo::PendingRemote<mojom::DebugLogsChangeHandler> remote;
+  receivers_.Add(this, remote.InitWithNewPipeAndPassReceiver());
+  return remote;
 }
 
 void DebugLogsManager::ChangeDebugLogsState(bool should_debug_logs_be_enabled) {
diff --git a/chrome/browser/chromeos/bluetooth/debug_logs_manager.h b/chrome/browser/chromeos/bluetooth/debug_logs_manager.h
index 9d8fb65..935606f 100644
--- a/chrome/browser/chromeos/bluetooth/debug_logs_manager.h
+++ b/chrome/browser/chromeos/bluetooth/debug_logs_manager.h
@@ -7,7 +7,8 @@
 
 #include "base/macros.h"
 #include "chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals.mojom.h"
-#include "mojo/public/cpp/bindings/binding_set.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver_set.h"
 
 class PrefService;
 class PrefRegistrySimple;
@@ -44,15 +45,15 @@
   // mojom::DebugLogsManager:
   void ChangeDebugLogsState(bool should_debug_logs_be_enabled) override;
 
-  // Generates an InterfacePtr bound to this object.
-  mojom::DebugLogsChangeHandlerPtr GenerateInterfacePtr();
+  // Generates an PendingRemote bound to this object.
+  mojo::PendingRemote<mojom::DebugLogsChangeHandler> GenerateRemote();
 
  private:
   bool AreDebugLogsSupported() const;
 
   const std::string primary_user_email_;
   PrefService* pref_service_ = nullptr;
-  mojo::BindingSet<mojom::DebugLogsChangeHandler> bindings_;
+  mojo::ReceiverSet<mojom::DebugLogsChangeHandler> receivers_;
 
   DISALLOW_COPY_AND_ASSIGN(DebugLogsManager);
 };
diff --git a/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals.mojom b/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals.mojom
index ed3c332..47199fd 100644
--- a/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals.mojom
+++ b/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals.mojom
@@ -24,6 +24,7 @@
   // not supported (e.g., the required flags are disabled or the logged-in user
   // is not eligible), null is returned. When a valid handler is returned, an
   // extra boolean is provided which represents the initial state of the toggle.
-  GetDebugLogsChangeHandler() => (DebugLogsChangeHandler? handler,
-                                  bool initial_toggle_value);
+  GetDebugLogsChangeHandler()
+      => (pending_remote<DebugLogsChangeHandler>? handler,
+          bool initial_toggle_value);
 };
diff --git a/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_handler.cc b/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_handler.cc
index b88be86..d1138c1 100644
--- a/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_handler.cc
+++ b/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_handler.cc
@@ -12,7 +12,6 @@
 #include "chrome/browser/chromeos/bluetooth/debug_logs_manager.h"
 #include "device/bluetooth/adapter.h"
 #include "device/bluetooth/bluetooth_adapter_factory.h"
-#include "mojo/public/cpp/bindings/pending_receiver.h"
 #include "mojo/public/cpp/bindings/pending_remote.h"
 #include "mojo/public/cpp/bindings/self_owned_receiver.h"
 #include "url/gurl.h"
@@ -39,7 +38,7 @@
 
 void BluetoothInternalsHandler::GetDebugLogsChangeHandler(
     GetDebugLogsChangeHandlerCallback callback) {
-  mojom::DebugLogsChangeHandlerPtr handler_ptr;
+  mojo::PendingRemote<mojom::DebugLogsChangeHandler> handler_remote;
   bool initial_toggle_value = false;
 
 #if defined(OS_CHROMEOS)
@@ -52,18 +51,18 @@
 
   switch (state) {
     case DebugLogsManager::DebugLogsState::kNotSupported:
-      // Leave |handler_ptr| null and |initial_toggle_value| false.
+      // Leave |handler_remote| NullRemote and |initial_toggle_value| false.
       break;
     case DebugLogsManager::DebugLogsState::kSupportedAndEnabled:
       initial_toggle_value = true;
       FALLTHROUGH;
     case DebugLogsManager::DebugLogsState::kSupportedButDisabled:
-      handler_ptr = debug_logs_manager_->GenerateInterfacePtr();
+      handler_remote = debug_logs_manager_->GenerateRemote();
       break;
   }
 #endif
 
-  std::move(callback).Run(std::move(handler_ptr), initial_toggle_value);
+  std::move(callback).Run(std::move(handler_remote), initial_toggle_value);
 }
 
 void BluetoothInternalsHandler::OnGetAdapter(
diff --git a/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_handler.h b/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_handler.h
index 5c1cd35..16e715c 100644
--- a/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_handler.h
+++ b/chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_handler.h
@@ -8,7 +8,6 @@
 #include "base/macros.h"
 #include "chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals.mojom.h"
 #include "device/bluetooth/bluetooth_adapter.h"
-#include "mojo/public/cpp/bindings/binding_set.h"
 #include "mojo/public/cpp/bindings/pending_receiver.h"
 #include "mojo/public/cpp/bindings/receiver.h"