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> |
11 #include <unordered_map> | 11 #include <unordered_map> |
12 #include <utility> | 12 #include <utility> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/optional.h" |
| 17 #include "base/time/time.h" |
16 #include "chrome/browser/chooser_controller/chooser_controller.h" | 18 #include "chrome/browser/chooser_controller/chooser_controller.h" |
17 #include "content/public/browser/bluetooth_chooser.h" | 19 #include "content/public/browser/bluetooth_chooser.h" |
18 | 20 |
19 // BluetoothChooserController is a chooser that presents a list of | 21 // BluetoothChooserController is a chooser that presents a list of |
20 // Bluetooth device names, which come from |bluetooth_chooser_desktop_|. | 22 // Bluetooth device names, which come from |bluetooth_chooser_desktop_|. |
21 // It can be used by WebBluetooth API to get the user's permission to | 23 // It can be used by WebBluetooth API to get the user's permission to |
22 // access a Bluetooth device. It is owned by ChooserBubbleDelegate. | 24 // access a Bluetooth device. It is owned by ChooserBubbleDelegate. |
23 class BluetoothChooserController : public ChooserController { | 25 class BluetoothChooserController : public ChooserController { |
24 public: | 26 public: |
25 explicit BluetoothChooserController( | 27 explicit BluetoothChooserController( |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // Bluetooth adapter is turned on or off, or when re-scan happens. | 82 // Bluetooth adapter is turned on or off, or when re-scan happens. |
81 void ClearAllDevices(); | 83 void ClearAllDevices(); |
82 | 84 |
83 std::vector<BluetoothDeviceInfo> devices_; | 85 std::vector<BluetoothDeviceInfo> devices_; |
84 std::unordered_map<std::string, base::string16> device_id_to_name_map_; | 86 std::unordered_map<std::string, base::string16> device_id_to_name_map_; |
85 // Maps from device name to number of devices with that name. | 87 // Maps from device name to number of devices with that name. |
86 std::unordered_map<base::string16, int> device_name_counts_; | 88 std::unordered_map<base::string16, int> device_name_counts_; |
87 | 89 |
88 content::BluetoothChooser::EventHandler event_handler_; | 90 content::BluetoothChooser::EventHandler event_handler_; |
89 base::string16 status_text_; | 91 base::string16 status_text_; |
| 92 base::Optional<base::TimeTicks> scanning_start_time_; |
90 | 93 |
91 DISALLOW_COPY_AND_ASSIGN(BluetoothChooserController); | 94 DISALLOW_COPY_AND_ASSIGN(BluetoothChooserController); |
92 }; | 95 }; |
93 | 96 |
94 #endif // CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_CONTROLLER_H_ | 97 #endif // CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_CONTROLLER_H_ |
OLD | NEW |