#include "components/permissions/bluetooth_delegate_impl.h"
#include "base/observer_list.h"
#include "base/strings/utf_string_conversions.h"
#include "components/permissions/contexts/bluetooth_chooser_context.h"
#include "content/public/browser/render_frame_host.h"
#include "device/bluetooth/bluetooth_device.h"
#include "device/bluetooth/public/cpp/bluetooth_uuid.h"
#include "third_party/blink/public/common/bluetooth/web_bluetooth_device_id.h"
#include "third_party/blink/public/mojom/bluetooth/web_bluetooth.mojom.h"
WebBluetoothDeviceId;
RenderFrameHost;
BluetoothUUID;
namespace permissions {
BluetoothDelegateImpl::BluetoothDelegateImpl(std::unique_ptr<Client> client)
: … { … }
BluetoothDelegateImpl::~BluetoothDelegateImpl() = default;
std::unique_ptr<content::BluetoothChooser>
BluetoothDelegateImpl::RunBluetoothChooser(
content::RenderFrameHost* frame,
const content::BluetoothChooser::EventHandler& event_handler) { … }
std::unique_ptr<content::BluetoothScanningPrompt>
BluetoothDelegateImpl::ShowBluetoothScanningPrompt(
content::RenderFrameHost* frame,
const content::BluetoothScanningPrompt::EventHandler& event_handler) { … }
void BluetoothDelegateImpl::ShowDevicePairPrompt(
RenderFrameHost* frame,
const std::u16string& device_identifier,
PairPromptCallback callback,
PairingKind pairing_kind,
const std::optional<std::u16string>& pin) { … }
WebBluetoothDeviceId BluetoothDelegateImpl::GetWebBluetoothDeviceId(
RenderFrameHost* frame,
const std::string& device_address) { … }
std::string BluetoothDelegateImpl::GetDeviceAddress(
RenderFrameHost* frame,
const WebBluetoothDeviceId& device_id) { … }
WebBluetoothDeviceId BluetoothDelegateImpl::AddScannedDevice(
RenderFrameHost* frame,
const std::string& device_address) { … }
WebBluetoothDeviceId BluetoothDelegateImpl::GrantServiceAccessPermission(
RenderFrameHost* frame,
const device::BluetoothDevice* device,
const blink::mojom::WebBluetoothRequestDeviceOptions* options) { … }
bool BluetoothDelegateImpl::HasDevicePermission(
RenderFrameHost* frame,
const WebBluetoothDeviceId& device_id) { … }
void BluetoothDelegateImpl::RevokeDevicePermissionWebInitiated(
RenderFrameHost* frame,
const WebBluetoothDeviceId& device_id) { … }
bool BluetoothDelegateImpl::IsAllowedToAccessService(
RenderFrameHost* frame,
const WebBluetoothDeviceId& device_id,
const BluetoothUUID& service) { … }
bool BluetoothDelegateImpl::IsAllowedToAccessAtLeastOneService(
RenderFrameHost* frame,
const WebBluetoothDeviceId& device_id) { … }
bool BluetoothDelegateImpl::IsAllowedToAccessManufacturerData(
RenderFrameHost* frame,
const WebBluetoothDeviceId& device_id,
uint16_t manufacturer_code) { … }
void BluetoothDelegateImpl::AddFramePermissionObserver(
FramePermissionObserver* observer) { … }
void BluetoothDelegateImpl::RemoveFramePermissionObserver(
FramePermissionObserver* observer) { … }
std::vector<blink::mojom::WebBluetoothDevicePtr>
BluetoothDelegateImpl::GetPermittedDevices(content::RenderFrameHost* frame) { … }
BluetoothDelegateImpl::ChooserContextPermissionObserver::
ChooserContextPermissionObserver(BluetoothDelegateImpl* owning_delegate,
ObjectPermissionContextBase* context)
: … { … }
BluetoothDelegateImpl::ChooserContextPermissionObserver::
~ChooserContextPermissionObserver() = default;
void BluetoothDelegateImpl::ChooserContextPermissionObserver::
OnPermissionRevoked(const url::Origin& origin) { … }
void BluetoothDelegateImpl::ChooserContextPermissionObserver::
AddFramePermissionObserver(FramePermissionObserver* observer) { … }
void BluetoothDelegateImpl::ChooserContextPermissionObserver::
RemoveFramePermissionObserver(FramePermissionObserver* observer) { … }
}