| 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_BUBBLE_CONTROLLER_H_ | |
| 6 #define CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_BUBBLE_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 "chrome/browser/ui/website_settings/chooser_bubble_controller.h" | |
| 16 #include "components/bubble/bubble_reference.h" | |
| 17 | |
| 18 class BluetoothChooserDesktop; | |
| 19 | |
| 20 // BluetoothChooserBubbleController is a chooser that presents a list of | |
| 21 // Bluetooth device names, which come from |bluetooth_chooser_desktop_|. | |
| 22 // It can be used by WebBluetooth API to get the user's permission to | |
| 23 // access a Bluetooth device. | |
| 24 class BluetoothChooserBubbleController : public ChooserBubbleController { | |
| 25 public: | |
| 26 explicit BluetoothChooserBubbleController(content::RenderFrameHost* owner); | |
| 27 ~BluetoothChooserBubbleController() override; | |
| 28 | |
| 29 // ChooserBubbleController: | |
| 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 GURL GetHelpCenterUrl() 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 void set_bluetooth_chooser(BluetoothChooserDesktop* bluetooth_chooser) { | |
| 45 bluetooth_chooser_ = bluetooth_chooser; | |
| 46 } | |
| 47 | |
| 48 void set_bubble_reference(BubbleReference bubble_reference) { | |
| 49 bubble_reference_ = bubble_reference; | |
| 50 } | |
| 51 | |
| 52 private: | |
| 53 // Each pair is a (device name, device id). | |
| 54 std::vector<std::pair<base::string16, std::string>> device_names_and_ids_; | |
| 55 BluetoothChooserDesktop* bluetooth_chooser_; | |
| 56 BubbleReference bubble_reference_; | |
| 57 | |
| 58 DISALLOW_COPY_AND_ASSIGN(BluetoothChooserBubbleController); | |
| 59 }; | |
| 60 | |
| 61 #endif // CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_BUBBLE_CONTROLLER_H_ | |
| OLD | NEW |