#include "content/web_test/browser/fake_bluetooth_delegate.h"
#include "base/containers/contains.h"
#include "content/public/browser/web_contents.h"
#include "content/web_test/browser/web_test_control_host.h"
#include "device/bluetooth/bluetooth_device.h"
#include "third_party/blink/public/common/bluetooth/web_bluetooth_device_id.h"
#include "third_party/blink/public/mojom/bluetooth/web_bluetooth.mojom.h"
#include "url/origin.h"
WebBluetoothDeviceId;
BluetoothDevice;
BluetoothUUID;
namespace content {
namespace {
class AlwaysAllowBluetoothScanning : public BluetoothScanningPrompt { … };
}
FakeBluetoothDelegate::FakeBluetoothDelegate() = default;
FakeBluetoothDelegate::~FakeBluetoothDelegate() = default;
std::unique_ptr<BluetoothChooser> FakeBluetoothDelegate::RunBluetoothChooser(
RenderFrameHost* frame,
const BluetoothChooser::EventHandler& event_handler) { … }
std::unique_ptr<BluetoothScanningPrompt>
FakeBluetoothDelegate::ShowBluetoothScanningPrompt(
RenderFrameHost* frame,
const BluetoothScanningPrompt::EventHandler& event_handler) { … }
void FakeBluetoothDelegate::ShowDevicePairPrompt(
RenderFrameHost* frame,
const std::u16string& device_identifier,
PairPromptCallback callback,
PairingKind pairing_kind,
const std::optional<std::u16string>& pin) { … }
WebBluetoothDeviceId FakeBluetoothDelegate::GetWebBluetoothDeviceId(
RenderFrameHost* frame,
const std::string& device_address) { … }
std::string FakeBluetoothDelegate::GetDeviceAddress(
RenderFrameHost* frame,
const WebBluetoothDeviceId& device_id) { … }
blink::WebBluetoothDeviceId FakeBluetoothDelegate::AddScannedDevice(
RenderFrameHost* frame,
const std::string& device_address) { … }
WebBluetoothDeviceId FakeBluetoothDelegate::GrantServiceAccessPermission(
RenderFrameHost* frame,
const BluetoothDevice* device,
const blink::mojom::WebBluetoothRequestDeviceOptions* options) { … }
bool FakeBluetoothDelegate::HasDevicePermission(
RenderFrameHost* frame,
const WebBluetoothDeviceId& device_id) { … }
void FakeBluetoothDelegate::RevokeDevicePermissionWebInitiated(
RenderFrameHost* frame,
const WebBluetoothDeviceId& device_id) { … }
bool FakeBluetoothDelegate::IsAllowedToAccessService(
RenderFrameHost* frame,
const WebBluetoothDeviceId& device_id,
const BluetoothUUID& service) { … }
bool FakeBluetoothDelegate::IsAllowedToAccessAtLeastOneService(
RenderFrameHost* frame,
const WebBluetoothDeviceId& device_id) { … }
bool FakeBluetoothDelegate::IsAllowedToAccessManufacturerData(
RenderFrameHost* frame,
const blink::WebBluetoothDeviceId& device_id,
const uint16_t manufacturer_code) { … }
void FakeBluetoothDelegate::AddFramePermissionObserver(
FramePermissionObserver* observer) { … }
void FakeBluetoothDelegate::RemoveFramePermissionObserver(
FramePermissionObserver* observer) { … }
std::vector<blink::mojom::WebBluetoothDevicePtr>
FakeBluetoothDelegate::GetPermittedDevices(RenderFrameHost* frame) { … }
WebBluetoothDeviceId FakeBluetoothDelegate::GetOrCreateDeviceIdForDeviceAddress(
RenderFrameHost* frame,
const std::string& device_address) { … }
void FakeBluetoothDelegate::GrantUnionOfServicesAndManufacturerDataForDevice(
const WebBluetoothDeviceId& device_id,
const blink::mojom::WebBluetoothRequestDeviceOptions* options) { … }
FakeBluetoothDelegate::AddressToIdMap&
FakeBluetoothDelegate::GetAddressToIdMapForOrigin(RenderFrameHost* frame) { … }
}