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_DELEGATE_H_ |
6 #define CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_BUBBLE_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_BUBBLE_DELEGATE_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_delegate.h" |
12 #include "components/bubble/bubble_reference.h" | 12 #include "components/bubble/bubble_reference.h" |
13 #include "url/gurl.h" | |
Jeffrey Yasskin
2016/01/06 19:10:55
I think you can forward-declare GURL too.
juncai
2016/01/11 21:55:16
This include is removed since the related code has
| |
14 | |
15 namespace content { | |
16 class WebContents; | |
17 } | |
13 | 18 |
14 class Browser; | 19 class Browser; |
15 class BluetoothChooserDesktop; | 20 class BluetoothChooserDesktop; |
16 | 21 |
17 // BluetoothChooserBubbleDelegate is a chooser that presents a list of | 22 // BluetoothChooserBubbleDelegate is a chooser that presents a list of |
18 // Bluetooth device names, which come from |bluetooth_chooser_desktop_|. | 23 // Bluetooth device names, which come from |bluetooth_chooser_desktop_|. |
19 // It can be used by WebBluetooth API to get the user's permission to | 24 // It can be used by WebBluetooth API to get the user's permission to |
20 // access a Bluetooth device. | 25 // access a Bluetooth device. |
21 class BluetoothChooserBubbleDelegate : public ChooserBubbleDelegate { | 26 class BluetoothChooserBubbleDelegate : public ChooserBubbleDelegate { |
22 public: | 27 public: |
23 explicit BluetoothChooserBubbleDelegate(Browser* browser); | 28 explicit BluetoothChooserBubbleDelegate(Browser* browser, |
29 content::WebContents* web_contents, | |
30 const GURL& origin); | |
24 ~BluetoothChooserBubbleDelegate() override; | 31 ~BluetoothChooserBubbleDelegate() override; |
25 | 32 |
26 // ChooserBubbleDelegate: | 33 // ChooserBubbleDelegate: |
27 size_t NumOptions() const override; | 34 size_t NumOptions() const override; |
28 const base::string16& GetOption(size_t index) const override; | 35 const base::string16& GetOption(size_t index) const override; |
29 void Select(size_t index) override; | 36 void Select(size_t index) override; |
30 void Cancel() override; | 37 void Cancel() override; |
31 void Close() override; | 38 void Close() override; |
32 | 39 |
33 // Shows a new device in the chooser. | 40 // Shows a new device in the chooser. |
34 void AddDevice(const std::string& device_id, | 41 void AddDevice(const std::string& device_id, |
35 const base::string16& device_name); | 42 const base::string16& device_name); |
36 | 43 |
37 // Tells the chooser that a device is no longer available. | 44 // Tells the chooser that a device is no longer available. |
38 void RemoveDevice(const std::string& device_id); | 45 void RemoveDevice(const std::string& device_id); |
39 | 46 |
40 void set_bluetooth_chooser(BluetoothChooserDesktop* bluetooth_chooser) { | 47 void set_bluetooth_chooser(BluetoothChooserDesktop* bluetooth_chooser) { |
41 bluetooth_chooser_ = bluetooth_chooser; | 48 bluetooth_chooser_ = bluetooth_chooser; |
42 } | 49 } |
43 | 50 |
44 void set_bubble_controller(BubbleReference bubble_controller) { | 51 void set_bubble_controller(BubbleReference bubble_controller) { |
45 bubble_controller_ = bubble_controller; | 52 bubble_controller_ = bubble_controller; |
46 } | 53 } |
47 | 54 |
48 private: | 55 private: |
49 // Each pair is a (device name, device id). | 56 // Each pair is a (device name, device id). |
50 std::vector<std::pair<base::string16, std::string>> device_names_and_ids_; | 57 std::vector<std::pair<base::string16, std::string>> device_names_and_ids_; |
58 content::WebContents* web_contents_; | |
59 GURL origin_; | |
51 BluetoothChooserDesktop* bluetooth_chooser_; | 60 BluetoothChooserDesktop* bluetooth_chooser_; |
52 BubbleReference bubble_controller_; | 61 BubbleReference bubble_controller_; |
53 | 62 |
54 DISALLOW_COPY_AND_ASSIGN(BluetoothChooserBubbleDelegate); | 63 DISALLOW_COPY_AND_ASSIGN(BluetoothChooserBubbleDelegate); |
55 }; | 64 }; |
56 | 65 |
57 #endif // CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_BUBBLE_DELEGATE_H_ | 66 #endif // CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_BUBBLE_DELEGATE_H_ |
OLD | NEW |