Fix emulator build error
[platform/framework/web/chromium-efl.git] / components / permissions / bluetooth_chooser_desktop.h
1 // Copyright 2015 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_CHOOSER_DESKTOP_H_
6 #define COMPONENTS_PERMISSIONS_BLUETOOTH_CHOOSER_DESKTOP_H_
7
8 #include "base/functional/callback_helpers.h"
9 #include "base/memory/weak_ptr.h"
10 #include "content/public/browser/bluetooth_chooser.h"
11
12 namespace permissions {
13
14 class BluetoothChooserController;
15 class ChooserController;
16
17 // Represents a Bluetooth chooser to ask the user to select a Bluetooth
18 // device from a list of options. This implementation is for desktop.
19 // BluetoothChooserAndroid implements the mobile part.
20 class BluetoothChooserDesktop : public content::BluetoothChooser {
21  public:
22   // The OnceClosure returned by |show_dialog_callback| can be invoked to close
23   // the dialog. It should be a no-op to invoke the closure if the dialog has
24   // already been closed by the user.
25   BluetoothChooserDesktop(
26       std::unique_ptr<permissions::BluetoothChooserController> controller,
27       base::OnceCallback<
28           base::OnceClosure(std::unique_ptr<permissions::ChooserController>)>
29           show_dialog_callback);
30
31   BluetoothChooserDesktop(const BluetoothChooserDesktop&) = delete;
32   BluetoothChooserDesktop& operator=(const BluetoothChooserDesktop&) = delete;
33
34   ~BluetoothChooserDesktop() override;
35
36   // BluetoothChooser:
37   void SetAdapterPresence(AdapterPresence presence) override;
38   void ShowDiscoveryState(DiscoveryState state) override;
39   void AddOrUpdateDevice(const std::string& device_id,
40                          bool should_update_name,
41                          const std::u16string& device_name,
42                          bool is_gatt_connected,
43                          bool is_paired,
44                          int signal_strength_level) override;
45
46  private:
47   // DeviceChooserContentView owns the controller.
48   base::WeakPtr<BluetoothChooserController> bluetooth_chooser_controller_;
49
50   // Closes the displayed UI if it is still open. Used to ensure the bubble
51   // closes if this controller is torn down.
52   base::ScopedClosureRunner close_closure_runner_;
53 };
54
55 }  // namespace permissions
56
57 #endif  // COMPONENTS_PERMISSIONS_BLUETOOTH_CHOOSER_DESKTOP_H_