chromium/content/browser/bluetooth/web_bluetooth_pairing_manager_impl.cc

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/bluetooth/web_bluetooth_pairing_manager_impl.h"

#include <utility>

#include "base/functional/callback_helpers.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "content/browser/bluetooth/web_bluetooth_pairing_manager_delegate.h"
#include "content/browser/bluetooth/web_bluetooth_service_impl.h"
#include "content/public/browser/bluetooth_delegate.h"

namespace content {

namespace {

WebBluetoothService;
BluetoothDevice;

void OnPairForReadCharacteristicCallback(
    std::string characteristic_instance_id,
    WebBluetoothPairingManagerDelegate* pairing_manager_delegate,
    WebBluetoothService::RemoteCharacteristicReadValueCallback callback,
    std::optional<BluetoothDevice::ConnectErrorCode> error_code) {}

void OnPairForWriteCharacteristicCallback(
    std::string characteristic_instance_id,
    WebBluetoothPairingManagerDelegate* pairing_manager_delegate,
    std::vector<uint8_t> value,
    blink::mojom::WebBluetoothWriteType write_type,
    WebBluetoothService::RemoteCharacteristicWriteValueCallback callback,
    std::optional<BluetoothDevice::ConnectErrorCode> error_code) {}

void OnPairForReadDescriptorCallback(
    const std::string& descriptor_instance_id,
    WebBluetoothPairingManagerDelegate* pairing_manager_delegate,
    WebBluetoothService::RemoteDescriptorReadValueCallback callback,
    std::optional<BluetoothDevice::ConnectErrorCode> error_code) {}

void OnPairForWriteDescriptorCallback(
    const std::string& descriptor_instance_id,
    WebBluetoothPairingManagerDelegate* pairing_manager_delegate,
    std::vector<uint8_t> value,
    WebBluetoothService::RemoteDescriptorWriteValueCallback callback,
    std::optional<BluetoothDevice::ConnectErrorCode> error_code) {}

void OnPairCharacteristicStartNotifications(
    const std::string& characteristic_instance_id,
    mojo::AssociatedRemote<blink::mojom::WebBluetoothCharacteristicClient>
        client,
    WebBluetoothPairingManagerDelegate* pairing_manager_delegate,
    WebBluetoothService::RemoteCharacteristicStartNotificationsCallback
        callback,
    std::optional<BluetoothDevice::ConnectErrorCode> error_code) {}

}  // namespace

constexpr int WebBluetoothPairingManagerImpl::kMaxPairAttempts;

// TODO(crbug.com/40626253): Ensure this delegate outlives any in-progress
// pairing operation for which it is used. Additionally review use of
// WebBluetoothDeviceId vs. BluetoothDevice as well as how to deal with
// simultaneous pairing requests for the same device.
WebBluetoothPairingManagerImpl::WebBluetoothPairingManagerImpl(
    WebBluetoothPairingManagerDelegate* pairing_manager_delegate)
    :{}

WebBluetoothPairingManagerImpl::~WebBluetoothPairingManagerImpl() {}

void WebBluetoothPairingManagerImpl::PairForCharacteristicReadValue(
    const std::string& characteristic_instance_id,
    WebBluetoothService::RemoteCharacteristicReadValueCallback read_callback) {}

void WebBluetoothPairingManagerImpl::PairForCharacteristicWriteValue(
    const std::string& characteristic_instance_id,
    const std::vector<uint8_t>& value,
    blink::mojom::WebBluetoothWriteType write_type,
    WebBluetoothService::RemoteCharacteristicWriteValueCallback callback) {}

void WebBluetoothPairingManagerImpl::PairForDescriptorReadValue(
    const std::string& descriptor_instance_id,
    WebBluetoothService::RemoteDescriptorReadValueCallback read_callback) {}

void WebBluetoothPairingManagerImpl::PairForDescriptorWriteValue(
    const std::string& descriptor_instance_id,
    const std::vector<uint8_t>& value,
    WebBluetoothService::RemoteDescriptorWriteValueCallback callback) {}

void WebBluetoothPairingManagerImpl::PairForCharacteristicStartNotifications(
    const std::string& characteristic_instance_id,
    mojo::AssociatedRemote<blink::mojom::WebBluetoothCharacteristicClient>
        client,
    blink::mojom::WebBluetoothService::
        RemoteCharacteristicStartNotificationsCallback callback) {}

void WebBluetoothPairingManagerImpl::PairDevice(
    blink::WebBluetoothDeviceId device_id,
    int num_pair_attempts,
    device::BluetoothDevice::ConnectCallback callback) {}

void WebBluetoothPairingManagerImpl::OnPairDevice(
    blink::WebBluetoothDeviceId device_id,
    int num_pair_attempts,
    BluetoothDevice::ConnectCallback callback,
    std::optional<BluetoothDevice::ConnectErrorCode> error_code) {}

void WebBluetoothPairingManagerImpl::RequestPinCode(BluetoothDevice* device) {}

void WebBluetoothPairingManagerImpl::OnPinCodeResult(
    blink::WebBluetoothDeviceId device_id,
    const BluetoothDelegate::PairPromptResult& result) {}

void WebBluetoothPairingManagerImpl::OnPairConfirmResult(
    blink::WebBluetoothDeviceId device_id,
    const BluetoothDelegate::PairPromptResult& result) {}

void WebBluetoothPairingManagerImpl::RequestPasskey(BluetoothDevice* device) {}

void WebBluetoothPairingManagerImpl::DisplayPinCode(
    BluetoothDevice* device,
    const std::string& pincode) {}

void WebBluetoothPairingManagerImpl::DisplayPasskey(BluetoothDevice* device,
                                                    uint32_t passkey) {}

void WebBluetoothPairingManagerImpl::KeysEntered(BluetoothDevice* device,
                                                 uint32_t entered) {}

void WebBluetoothPairingManagerImpl::ConfirmPasskey(BluetoothDevice* device,
                                                    uint32_t passkey) {}

void WebBluetoothPairingManagerImpl::AuthorizePairing(BluetoothDevice* device) {}

}  // namespace content