OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 |
| 5 #ifndef CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_CONTROLLER_H_ |
| 7 |
| 8 #include <stddef.h> |
| 9 |
| 10 #include <string> |
| 11 #include <utility> |
| 12 #include <vector> |
| 13 |
| 14 #include "base/macros.h" |
| 15 #include "components/ui/chooser_controller/chooser_controller.h" |
| 16 #include "content/public/browser/bluetooth_chooser.h" |
| 17 |
| 18 // BluetoothChooserController is a chooser that presents a list of |
| 19 // Bluetooth device names, which come from |bluetooth_chooser_desktop_|. |
| 20 // It can be used by WebBluetooth API to get the user's permission to |
| 21 // access a Bluetooth device. It is owned by ChooserBubbleDelegate. |
| 22 class BluetoothChooserController : public ChooserController { |
| 23 public: |
| 24 explicit BluetoothChooserController( |
| 25 content::RenderFrameHost* owner, |
| 26 const content::BluetoothChooser::EventHandler& event_handler); |
| 27 ~BluetoothChooserController() override; |
| 28 |
| 29 // ChooserController: |
| 30 size_t NumOptions() const override; |
| 31 const base::string16& GetOption(size_t index) const override; |
| 32 void Select(size_t index) override; |
| 33 void Cancel() override; |
| 34 void Close() override; |
| 35 void OpenHelpCenterUrl() const override; |
| 36 |
| 37 // Shows a new device in the chooser. |
| 38 void AddDevice(const std::string& device_id, |
| 39 const base::string16& device_name); |
| 40 |
| 41 // Tells the chooser that a device is no longer available. |
| 42 void RemoveDevice(const std::string& device_id); |
| 43 |
| 44 private: |
| 45 // Each pair is a (device name, device id). |
| 46 std::vector<std::pair<base::string16, std::string>> device_names_and_ids_; |
| 47 content::BluetoothChooser::EventHandler event_handler_; |
| 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(BluetoothChooserController); |
| 50 }; |
| 51 |
| 52 #endif // CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_CONTROLLER_H_ |
OLD | NEW |