Fix emulator build error
[platform/framework/web/chromium-efl.git] / components / permissions / bluetooth_scanning_prompt_desktop.h
1 // Copyright 2019 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_PERMISSIONS_BLUETOOTH_SCANNING_PROMPT_DESKTOP_H_
6 #define COMPONENTS_PERMISSIONS_BLUETOOTH_SCANNING_PROMPT_DESKTOP_H_
7
8 #include <string>
9
10 #include "base/functional/callback_helpers.h"
11 #include "base/memory/weak_ptr.h"
12 #include "content/public/browser/bluetooth_scanning_prompt.h"
13
14 namespace content {
15 class RenderFrameHost;
16 }  // namespace content
17
18 namespace permissions {
19
20 class BluetoothScanningPromptController;
21 class ChooserController;
22
23 // Represents a Bluetooth scanning prompt to ask the user permission to
24 // allow a site to receive Bluetooth advertisement packets from Bluetooth
25 // devices. This implementation is for desktop.
26 class BluetoothScanningPromptDesktop : public content::BluetoothScanningPrompt {
27  public:
28   // The OnceClosure returned by |show_dialog_callback| can be invoked to close
29   // the dialog. It should be a no-op to invoke the closure if the dialog has
30   // already been closed by the user.
31   BluetoothScanningPromptDesktop(
32       content::RenderFrameHost* frame,
33       const content::BluetoothScanningPrompt::EventHandler& event_handler,
34       std::u16string title,
35       base::OnceCallback<
36           base::OnceClosure(std::unique_ptr<permissions::ChooserController>)>
37           show_dialog_callback);
38
39   BluetoothScanningPromptDesktop(const BluetoothScanningPromptDesktop&) =
40       delete;
41   BluetoothScanningPromptDesktop& operator=(
42       const BluetoothScanningPromptDesktop&) = delete;
43
44   ~BluetoothScanningPromptDesktop() override;
45
46   // content::BluetoothScanningPrompt:
47   void AddOrUpdateDevice(const std::string& device_id,
48                          bool should_update_name,
49                          const std::u16string& device_name) override;
50
51  private:
52   // DeviceChooserContentView owns the controller.
53   base::WeakPtr<BluetoothScanningPromptController>
54       bluetooth_scanning_prompt_controller_;
55
56   // Closes the displayed UI, if there is one. This is used to ensure the UI
57   // closes if this controller is destroyed.
58   base::ScopedClosureRunner close_closure_runner_;
59 };
60
61 }  // namespace permissions
62
63 #endif  // COMPONENTS_PERMISSIONS_BLUETOOTH_SCANNING_PROMPT_DESKTOP_H_