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

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

Issue 1984923002: Refactor ChooserBubbleController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 7 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_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_
OLDNEW
« no previous file with comments | « chrome/browser/ui/DEPS ('k') | chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698