1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55

content / shell / browser / bluetooth / shell_bluetooth_delegate_impl_client.cc [blame]

// Copyright 2023 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/shell/browser/bluetooth/shell_bluetooth_delegate_impl_client.h"

#include "build/build_config.h"
#include "content/public/browser/render_frame_host.h"

#if BUILDFLAG(IS_IOS)
#include "content/shell/browser/bluetooth/ios/shell_bluetooth_chooser_ios.h"
#endif

namespace content {

ShellBluetoothDelegateImplClient::ShellBluetoothDelegateImplClient() = default;

ShellBluetoothDelegateImplClient::~ShellBluetoothDelegateImplClient() = default;

permissions::BluetoothChooserContext*
ShellBluetoothDelegateImplClient::GetBluetoothChooserContext(
    RenderFrameHost* frame) {
  // TODO(crbug.com/40263537): Implement ShellBluetoothChooserContextFactory.
  return nullptr;
}

std::unique_ptr<content::BluetoothChooser>
ShellBluetoothDelegateImplClient::RunBluetoothChooser(
    RenderFrameHost* frame,
    const BluetoothChooser::EventHandler& event_handler) {
#if BUILDFLAG(IS_IOS)
  return std::make_unique<ShellBluetoothChooserIOS>(frame, event_handler);
#else
  return nullptr;
#endif
}

std::unique_ptr<BluetoothScanningPrompt>
ShellBluetoothDelegateImplClient::ShowBluetoothScanningPrompt(
    RenderFrameHost* frame,
    const BluetoothScanningPrompt::EventHandler& event_handler) {
  // TODO(crbug.com/40263537): Implement BluetoothScanningPrompt for iOS.
  return nullptr;
}

void ShellBluetoothDelegateImplClient::ShowBluetoothDevicePairDialog(
    RenderFrameHost* frame,
    const std::u16string& device_identifier,
    BluetoothDelegate::PairPromptCallback callback,
    BluetoothDelegate::PairingKind,
    const std::optional<std::u16string>& pin) {
  std::move(callback).Run(BluetoothDelegate::PairPromptResult(
      BluetoothDelegate::PairPromptStatus::kCancelled));
}
}  // namespace content