| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // It can be used by WebBluetooth API to get the user's permission to | 21 // It can be used by WebBluetooth API to get the user's permission to |
| 22 // access a Bluetooth device. It is owned by ChooserBubbleDelegate. | 22 // access a Bluetooth device. It is owned by ChooserBubbleDelegate. |
| 23 class BluetoothChooserController : public ChooserController { | 23 class BluetoothChooserController : public ChooserController { |
| 24 public: | 24 public: |
| 25 explicit BluetoothChooserController( | 25 explicit BluetoothChooserController( |
| 26 content::RenderFrameHost* owner, | 26 content::RenderFrameHost* owner, |
| 27 const content::BluetoothChooser::EventHandler& event_handler); | 27 const content::BluetoothChooser::EventHandler& event_handler); |
| 28 ~BluetoothChooserController() override; | 28 ~BluetoothChooserController() override; |
| 29 | 29 |
| 30 // ChooserController: | 30 // ChooserController: |
| 31 base::string16 GetOkButtonLabel() const override; |
| 31 size_t NumOptions() const override; | 32 size_t NumOptions() const override; |
| 32 base::string16 GetOption(size_t index) const override; | 33 base::string16 GetOption(size_t index) const override; |
| 33 void Select(size_t index) override; | 34 void Select(size_t index) override; |
| 34 void Cancel() override; | 35 void Cancel() override; |
| 35 void Close() override; | 36 void Close() override; |
| 36 void OpenHelpCenterUrl() const override; | 37 void OpenHelpCenterUrl() const override; |
| 37 | 38 |
| 38 // Shows a new device in the chooser. | 39 // Shows a new device in the chooser. |
| 39 void AddDevice(const std::string& device_id, | 40 void AddDevice(const std::string& device_id, |
| 40 const base::string16& device_name); | 41 const base::string16& device_name); |
| 41 | 42 |
| 42 // Tells the chooser that a device is no longer available. | 43 // Tells the chooser that a device is no longer available. |
| 43 void RemoveDevice(const std::string& device_id); | 44 void RemoveDevice(const std::string& device_id); |
| 44 | 45 |
| 45 private: | 46 private: |
| 46 // Each pair is a (device name, device id). | 47 // Each pair is a (device name, device id). |
| 47 std::vector<std::pair<base::string16, std::string>> device_names_and_ids_; | 48 std::vector<std::pair<base::string16, std::string>> device_names_and_ids_; |
| 48 content::BluetoothChooser::EventHandler event_handler_; | 49 content::BluetoothChooser::EventHandler event_handler_; |
| 49 // Maps from device name to number of devices. | 50 // Maps from device name to number of devices. |
| 50 std::unordered_map<base::string16, int> device_name_map_; | 51 std::unordered_map<base::string16, int> device_name_map_; |
| 51 | 52 |
| 52 DISALLOW_COPY_AND_ASSIGN(BluetoothChooserController); | 53 DISALLOW_COPY_AND_ASSIGN(BluetoothChooserController); |
| 53 }; | 54 }; |
| 54 | 55 |
| 55 #endif // CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_CONTROLLER_H_ | 56 #endif // CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_CONTROLLER_H_ |
| OLD | NEW |