Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: chrome/browser/ui/bluetooth/bluetooth_chooser_controller.h

Issue 1984923002: Refactor ChooserBubbleController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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/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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698