weblayer_bluetooth_delegate_impl_client.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef WEBLAYER_BROWSER_BLUETOOTH_WEBLAYER_BLUETOOTH_DELEGATE_IMPL_CLIENT_H_
  5. #define WEBLAYER_BROWSER_BLUETOOTH_WEBLAYER_BLUETOOTH_DELEGATE_IMPL_CLIENT_H_
  6. #include <memory>
  7. #include "components/permissions/bluetooth_chooser_controller.h"
  8. #include "components/permissions/bluetooth_delegate_impl.h"
  9. #include "content/public/browser/bluetooth_delegate.h"
  10. namespace content {
  11. class RenderFrameHost;
  12. } // namespace content
  13. namespace permissions {
  14. class BluetoothChooserContext;
  15. } // namespace permissions
  16. namespace weblayer {
  17. // Provides embedder-level functionality to BluetoothDelegateImpl in WebLayer.
  18. class WebLayerBluetoothDelegateImplClient
  19. : public permissions::BluetoothDelegateImpl::Client {
  20. public:
  21. WebLayerBluetoothDelegateImplClient();
  22. ~WebLayerBluetoothDelegateImplClient() override;
  23. WebLayerBluetoothDelegateImplClient(
  24. const WebLayerBluetoothDelegateImplClient&) = delete;
  25. WebLayerBluetoothDelegateImplClient& operator=(
  26. const WebLayerBluetoothDelegateImplClient&) = delete;
  27. // BluetoothDelegateImpl::Client implementation:
  28. permissions::BluetoothChooserContext* GetBluetoothChooserContext(
  29. content::RenderFrameHost* frame) override;
  30. std::unique_ptr<content::BluetoothChooser> RunBluetoothChooser(
  31. content::RenderFrameHost* frame,
  32. const content::BluetoothChooser::EventHandler& event_handler) override;
  33. std::unique_ptr<content::BluetoothScanningPrompt> ShowBluetoothScanningPrompt(
  34. content::RenderFrameHost* frame,
  35. const content::BluetoothScanningPrompt::EventHandler& event_handler)
  36. override;
  37. void ShowBluetoothDevicePairDialog(
  38. content::RenderFrameHost* frame,
  39. const std::u16string& device_identifier,
  40. content::BluetoothDelegate::PairPromptCallback callback,
  41. content::BluetoothDelegate::PairingKind,
  42. const absl::optional<std::u16string>& pin) override;
  43. };
  44. } // namespace weblayer
  45. #endif // WEBLAYER_BROWSER_BLUETOOTH_WEBLAYER_BLUETOOTH_DELEGATE_IMPL_CLIENT_H_