Avi Drissman | 4a8573c | 2022-09-09 19:35:54 | [diff] [blame] | 1 | // Copyright 2021 The Chromium Authors |
Michael van Ouwerkerk | ed90512 | 2021-07-22 14:24:39 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "chrome/browser/bluetooth/chrome_bluetooth_delegate_impl_client.h" |
| 6 | |
| 7 | #include <memory> |
| 8 | |
| 9 | #include "build/build_config.h" |
| 10 | #include "chrome/browser/bluetooth/bluetooth_chooser_context_factory.h" |
| 11 | #include "chrome/browser/chooser_controller/title_util.h" |
| 12 | #include "chrome/browser/profiles/profile.h" |
Lei Zhang | 388730f | 2023-10-17 21:31:16 | [diff] [blame] | 13 | #include "chrome/browser/ui/bluetooth/bluetooth_dialogs.h" |
Michael van Ouwerkerk | ed90512 | 2021-07-22 14:24:39 | [diff] [blame] | 14 | #include "chrome/browser/ui/bluetooth/chrome_bluetooth_chooser_controller.h" |
| 15 | #include "chrome/browser/ui/browser_dialogs.h" |
| 16 | #include "content/public/browser/render_frame_host.h" |
| 17 | #include "content/public/browser/web_contents.h" |
| 18 | |
Xiaohan Wang | 9c67676f | 2022-01-15 21:51:32 | [diff] [blame] | 19 | #if BUILDFLAG(IS_ANDROID) |
Michael van Ouwerkerk | ed90512 | 2021-07-22 14:24:39 | [diff] [blame] | 20 | #include "chrome/browser/ui/android/device_dialog/chrome_bluetooth_chooser_android_delegate.h" |
| 21 | #include "chrome/browser/ui/android/device_dialog/chrome_bluetooth_scanning_prompt_android_delegate.h" |
Michael van Ouwerkerk | ed90512 | 2021-07-22 14:24:39 | [diff] [blame] | 22 | #include "components/permissions/android/bluetooth_chooser_android.h" |
| 23 | #include "components/permissions/android/bluetooth_scanning_prompt_android.h" |
| 24 | #else |
| 25 | #include "components/permissions/bluetooth_chooser_desktop.h" |
| 26 | #include "components/permissions/bluetooth_scanning_prompt_desktop.h" |
| 27 | #include "components/strings/grit/components_strings.h" |
Xiaohan Wang | 9c67676f | 2022-01-15 21:51:32 | [diff] [blame] | 28 | #endif // BUILDFLAG(IS_ANDROID) |
Michael van Ouwerkerk | ed90512 | 2021-07-22 14:24:39 | [diff] [blame] | 29 | |
| 30 | ChromeBluetoothDelegateImplClient::ChromeBluetoothDelegateImplClient() = |
| 31 | default; |
| 32 | |
| 33 | ChromeBluetoothDelegateImplClient::~ChromeBluetoothDelegateImplClient() = |
| 34 | default; |
| 35 | |
| 36 | permissions::BluetoothChooserContext* |
| 37 | ChromeBluetoothDelegateImplClient::GetBluetoothChooserContext( |
| 38 | content::RenderFrameHost* frame) { |
| 39 | auto* profile = Profile::FromBrowserContext(frame->GetBrowserContext()); |
| 40 | return BluetoothChooserContextFactory::GetForProfile(profile); |
| 41 | } |
| 42 | |
| 43 | std::unique_ptr<content::BluetoothChooser> |
| 44 | ChromeBluetoothDelegateImplClient::RunBluetoothChooser( |
| 45 | content::RenderFrameHost* frame, |
| 46 | const content::BluetoothChooser::EventHandler& event_handler) { |
Xiaohan Wang | 9c67676f | 2022-01-15 21:51:32 | [diff] [
|