| 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_BUBBLE_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_BUBBLE_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_BUBBLE_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_BUBBLE_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "chrome/browser/ui/website_settings/chooser_bubble_delegate.h" | 11 #include "chrome/browser/ui/website_settings/chooser_bubble_controller.h" |
| 12 #include "components/bubble/bubble_reference.h" | 12 #include "components/bubble/bubble_reference.h" |
| 13 | 13 |
| 14 class BluetoothChooserDesktop; | 14 class BluetoothChooserDesktop; |
| 15 | 15 |
| 16 // BluetoothChooserBubbleDelegate is a chooser that presents a list of | 16 // BluetoothChooserBubbleController is a chooser that presents a list of |
| 17 // Bluetooth device names, which come from |bluetooth_chooser_desktop_|. | 17 // Bluetooth device names, which come from |bluetooth_chooser_desktop_|. |
| 18 // It can be used by WebBluetooth API to get the user's permission to | 18 // It can be used by WebBluetooth API to get the user's permission to |
| 19 // access a Bluetooth device. | 19 // access a Bluetooth device. |
| 20 class BluetoothChooserBubbleDelegate : public ChooserBubbleDelegate { | 20 class BluetoothChooserBubbleController : public ChooserBubbleController { |
| 21 public: | 21 public: |
| 22 explicit BluetoothChooserBubbleDelegate(content::RenderFrameHost* owner); | 22 explicit BluetoothChooserBubbleController(content::RenderFrameHost* owner); |
| 23 ~BluetoothChooserBubbleDelegate() override; | 23 ~BluetoothChooserBubbleController() override; |
| 24 | 24 |
| 25 // ChooserBubbleDelegate: | 25 // ChooserBubbleController: |
| 26 size_t NumOptions() const override; | 26 size_t NumOptions() const override; |
| 27 const base::string16& GetOption(size_t index) const override; | 27 const base::string16& GetOption(size_t index) const override; |
| 28 void Select(size_t index) override; | 28 void Select(size_t index) override; |
| 29 void Cancel() override; | 29 void Cancel() override; |
| 30 void Close() override; | 30 void Close() override; |
| 31 GURL GetHelpCenterUrl() const override; | 31 GURL GetHelpCenterUrl() const override; |
| 32 | 32 |
| 33 // Shows a new device in the chooser. | 33 // Shows a new device in the chooser. |
| 34 void AddDevice(const std::string& device_id, | 34 void AddDevice(const std::string& device_id, |
| 35 const base::string16& device_name); | 35 const base::string16& device_name); |
| 36 | 36 |
| 37 // Tells the chooser that a device is no longer available. | 37 // Tells the chooser that a device is no longer available. |
| 38 void RemoveDevice(const std::string& device_id); | 38 void RemoveDevice(const std::string& device_id); |
| 39 | 39 |
| 40 void set_bluetooth_chooser(BluetoothChooserDesktop* bluetooth_chooser) { | 40 void set_bluetooth_chooser(BluetoothChooserDesktop* bluetooth_chooser) { |
| 41 bluetooth_chooser_ = bluetooth_chooser; | 41 bluetooth_chooser_ = bluetooth_chooser; |
| 42 } | 42 } |
| 43 | 43 |
| 44 void set_bubble_controller(BubbleReference bubble_controller) { | 44 void set_bubble_reference(BubbleReference bubble_reference) { |
| 45 bubble_controller_ = bubble_controller; | 45 bubble_reference_ = bubble_reference; |
| 46 } | 46 } |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 // Each pair is a (device name, device id). | 49 // Each pair is a (device name, device id). |
| 50 std::vector<std::pair<base::string16, std::string>> device_names_and_ids_; | 50 std::vector<std::pair<base::string16, std::string>> device_names_and_ids_; |
| 51 BluetoothChooserDesktop* bluetooth_chooser_; | 51 BluetoothChooserDesktop* bluetooth_chooser_; |
| 52 BubbleReference bubble_controller_; | 52 BubbleReference bubble_reference_; |
| 53 | 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(BluetoothChooserBubbleDelegate); | 54 DISALLOW_COPY_AND_ASSIGN(BluetoothChooserBubbleController); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 #endif // CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_BUBBLE_DELEGATE_H_ | 57 #endif // CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_BUBBLE_CONTROLLER_H_ |
| OLD | NEW |