Commit 0e97852c authored by Miyoung Shin's avatar Miyoung Shin Committed by Commit Bot

Convert FakeBluetoothChooserClient and HidManagerClient to new Mojo types

This CL cleans up TODOs of |associated| in
fake_bluetooth_chooser.mojom and hid.mojom since JS generator for
PendingAssociated is supported by crrev.com/c/1847331, and
converts FakeBluetoothChooserClientAssociatedPtrInfo and
HidManagerClientAssociatedPtrInfo to new Mojo types.

Bug: 955171
Change-Id: I505d74b8888dd7e4153ddb65c159a5c2efef25e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1872216Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@google.com>
Commit-Queue: Miyoung Shin <myid.shin@igalia.com>
Cr-Commit-Position: refs/heads/master@{#708890}
parent de26ec54
......@@ -12,7 +12,7 @@ FakeBluetoothChooserFactory::~FakeBluetoothChooserFactory() {}
void FakeBluetoothChooserFactory::CreateFakeBluetoothChooser(
mojo::PendingReceiver<mojom::FakeBluetoothChooser> receiver,
mojom::FakeBluetoothChooserClientAssociatedPtrInfo client) {
mojo::PendingAssociatedRemote<mojom::FakeBluetoothChooserClient> client) {
DCHECK(!next_fake_bluetooth_chooser_);
next_fake_bluetooth_chooser_ = std::make_unique<FakeBluetoothChooser>(
std::move(receiver), std::move(client));
......
......@@ -8,6 +8,7 @@
#include <memory>
#include "content/shell/common/web_test/fake_bluetooth_chooser.mojom.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
......@@ -43,7 +44,8 @@ class FakeBluetoothChooserFactory : public mojom::FakeBluetoothChooserFactory {
// |next_fake_bluetooth_chooser_| is not null.
void CreateFakeBluetoothChooser(
mojo::PendingReceiver<mojom::FakeBluetoothChooser> receiver,
mojom::FakeBluetoothChooserClientAssociatedPtrInfo client) override;
mojo::PendingAssociatedRemote<mojom::FakeBluetoothChooserClient> client)
override;
// Transfers ownership of |next_fake_bluetooth_chooser_| to the caller.
std::unique_ptr<FakeBluetoothChooser> GetNextFakeBluetoothChooser();
......
......@@ -52,13 +52,10 @@ interface FakeBluetoothChooser {
// FakeBluetoothChooserFactory ensures that FakeBluetoothChoosers are created
// with an associated FakeBluetoothChooserClient.
// TODO(crbug.com/955171): Use |pending_associated_remote| instead of
// |associated| after supporting mojom_js_generator.py completely for
// associated interfaces.
interface FakeBluetoothChooserFactory {
CreateFakeBluetoothChooser(
pending_receiver<FakeBluetoothChooser> fake_chooser,
associated FakeBluetoothChooserClient client);
pending_associated_remote<FakeBluetoothChooserClient> client);
};
// FakeBluetoothChooserEvent describes the type of chooser event that has been
......
......@@ -7,6 +7,7 @@
#include <utility>
#include "device/fido/fido_parsing_utils.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "services/device/public/mojom/constants.mojom.h"
#include "services/device/public/mojom/hid.mojom.h"
#include "services/service_manager/public/cpp/connector.h"
......@@ -152,7 +153,7 @@ void FakeFidoHidManager::AddFidoHidDevice(std::string guid) {
}
void FakeFidoHidManager::GetDevicesAndSetClient(
device::mojom::HidManagerClientAssociatedPtrInfo client,
mojo::PendingAssociatedRemote<device::mojom::HidManagerClient> client,
GetDevicesCallback callback) {
GetDevices(std::move(callback));
......
......@@ -107,7 +107,7 @@ class FakeFidoHidManager : public device::mojom::HidManager {
// device::mojom::HidManager implementation:
void GetDevicesAndSetClient(
device::mojom::HidManagerClientAssociatedPtrInfo client,
mojo::PendingAssociatedRemote<device::mojom::HidManagerClient> client,
GetDevicesCallback callback) override;
void GetDevices(GetDevicesCallback callback) override;
void Connect(
......
......@@ -44,7 +44,7 @@ void HidManagerImpl::AddReceiver(
}
void HidManagerImpl::GetDevicesAndSetClient(
mojom::HidManagerClientAssociatedPtrInfo client,
mojo::PendingAssociatedRemote<mojom::HidManagerClient> client,
GetDevicesCallback callback) {
hid_service_->GetDevices(base::BindOnce(
&HidManagerImpl::CreateDeviceList, weak_factory_.GetWeakPtr(),
......
......@@ -35,8 +35,9 @@ class HidManagerImpl : public mojom::HidManager, public HidService::Observer {
void AddReceiver(mojo::PendingReceiver<mojom::HidManager> receiver);
// mojom::HidManager implementation:
void GetDevicesAndSetClient(mojom::HidManagerClientAssociatedPtrInfo client,
GetDevicesCallback callback) override;
void GetDevicesAndSetClient(
mojo::PendingAssociatedRemote<mojom::HidManagerClient> client,
GetDevicesCallback callback) override;
void GetDevices(GetDevicesCallback callback) override;
void Connect(
const std::string& device_guid,
......
......@@ -101,7 +101,7 @@ void FakeHidManager::Bind(mojo::PendingReceiver<mojom::HidManager> receiver) {
// mojom::HidManager implementation:
void FakeHidManager::GetDevicesAndSetClient(
mojom::HidManagerClientAssociatedPtrInfo client,
mojo::PendingAssociatedRemote<mojom::HidManagerClient> client,
GetDevicesCallback callback) {
GetDevices(std::move(callback));
......
......@@ -9,6 +9,7 @@
#include <string>
#include <vector>
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/bindings/remote_set.h"
......@@ -45,8 +46,9 @@ class FakeHidManager : public mojom::HidManager {
void Bind(mojo::PendingReceiver<mojom::HidManager> receiver);
// mojom::HidManager implementation:
void GetDevicesAndSetClient(mojom::HidManagerClientAssociatedPtrInfo client,
GetDevicesCallback callback) override;
void GetDevicesAndSetClient(
mojo::PendingAssociatedRemote<mojom::HidManagerClient> client,
GetDevicesCallback callback) override;
void GetDevices(GetDevicesCallback callback) override;
void Connect(
const std::string& device_guid,
......
......@@ -314,10 +314,7 @@ interface HidManager {
// Enumerates available devices and set as a client of HidManager.
// The implementation of HidManager guarantees that the returned callback
// will always be posted earlier than DeviceAdded() and DeviceRemoved().
// TODO(crbug.com/955171): Use |pending_associated_remote| instead of
// |associated| after supporting mojom_js_generator.py completely for
// associated interfaces.
GetDevicesAndSetClient(associated HidManagerClient client) =>
GetDevicesAndSetClient(pending_associated_remote<HidManagerClient> client) =>
(array<HidDeviceInfo> devices);
// Enumerates available devices only.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment