OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 ASH_COMMON_SYSTEM_CHROMEOS_BLUETOOTH_TRAY_BLUETOOTH_HELPER_H_ | 5 #ifndef ASH_COMMON_SYSTEM_CHROMEOS_BLUETOOTH_TRAY_BLUETOOTH_HELPER_H_ |
6 #define ASH_COMMON_SYSTEM_CHROMEOS_BLUETOOTH_TRAY_BLUETOOTH_HELPER_H_ | 6 #define ASH_COMMON_SYSTEM_CHROMEOS_BLUETOOTH_TRAY_BLUETOOTH_HELPER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "ash/ash_export.h" | 11 #include "ash/ash_export.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "device/bluetooth/bluetooth_adapter.h" | 15 #include "device/bluetooth/bluetooth_adapter.h" |
16 | 16 |
17 namespace device { | 17 namespace device { |
18 class BluetoothDiscoverySession; | 18 class BluetoothDiscoverySession; |
19 } | 19 } |
20 | 20 |
21 namespace ash { | 21 namespace ash { |
22 | 22 |
23 // TODO(jamescook): Convert TrayBlueooth to use device::BluetoothDevice and | 23 // Cached info from device::BluetoothDevice used for display in the UI. |
24 // delete this. http://crbug.com/660043 | 24 // Exists because it is not safe to cache pointers to device::BluetoothDevice |
25 // instances. | |
25 struct ASH_EXPORT BluetoothDeviceInfo { | 26 struct ASH_EXPORT BluetoothDeviceInfo { |
James Cook
2017/03/21 23:35:35
It's possible this struct could be eliminated by m
msw
2017/03/21 23:48:41
Acknowledged.
| |
26 BluetoothDeviceInfo(); | 27 BluetoothDeviceInfo(); |
27 BluetoothDeviceInfo(const BluetoothDeviceInfo& other); | 28 BluetoothDeviceInfo(const BluetoothDeviceInfo& other); |
28 ~BluetoothDeviceInfo(); | 29 ~BluetoothDeviceInfo(); |
29 | 30 |
30 std::string address; | 31 std::string address; |
31 base::string16 display_name; | 32 base::string16 display_name; |
32 bool connected; | 33 bool connected; |
33 bool connecting; | 34 bool connecting; |
34 bool paired; | 35 bool paired; |
35 device::BluetoothDeviceType device_type; | 36 device::BluetoothDeviceType device_type; |
(...skipping 12 matching lines...) Expand all Loading... | |
48 ~TrayBluetoothHelper() override; | 49 ~TrayBluetoothHelper() override; |
49 | 50 |
50 // Initializes and gets the adapter asynchronously. | 51 // Initializes and gets the adapter asynchronously. |
51 void Initialize(); | 52 void Initialize(); |
52 | 53 |
53 // Completes initialization after the Bluetooth adapter is ready. | 54 // Completes initialization after the Bluetooth adapter is ready. |
54 void InitializeOnAdapterReady( | 55 void InitializeOnAdapterReady( |
55 scoped_refptr<device::BluetoothAdapter> adapter); | 56 scoped_refptr<device::BluetoothAdapter> adapter); |
56 | 57 |
57 // Returns a list of available bluetooth devices. | 58 // Returns a list of available bluetooth devices. |
58 // TODO(jamescook): Just return the list. | 59 BluetoothDeviceList GetAvailableBluetoothDevices() const; |
59 void GetAvailableBluetoothDevices(std::vector<BluetoothDeviceInfo>* list); | |
60 | 60 |
61 // Requests bluetooth start discovering devices, which happens asynchronously. | 61 // Requests bluetooth start discovering devices, which happens asynchronously. |
62 void StartBluetoothDiscovering(); | 62 void StartBluetoothDiscovering(); |
63 | 63 |
64 // Requests bluetooth stop discovering devices. | 64 // Requests bluetooth stop discovering devices. |
65 void StopBluetoothDiscovering(); | 65 void StopBluetoothDiscovering(); |
66 | 66 |
67 // Connect to a specific bluetooth device. | 67 // Connect to a specific bluetooth device. |
68 void ConnectToBluetoothDevice(const std::string& address); | 68 void ConnectToBluetoothDevice(const std::string& address); |
69 | 69 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 | 104 |
105 // Object could be deleted during a prolonged Bluetooth operation. | 105 // Object could be deleted during a prolonged Bluetooth operation. |
106 base::WeakPtrFactory<TrayBluetoothHelper> weak_ptr_factory_; | 106 base::WeakPtrFactory<TrayBluetoothHelper> weak_ptr_factory_; |
107 | 107 |
108 DISALLOW_COPY_AND_ASSIGN(TrayBluetoothHelper); | 108 DISALLOW_COPY_AND_ASSIGN(TrayBluetoothHelper); |
109 }; | 109 }; |
110 | 110 |
111 } // namespace ash | 111 } // namespace ash |
112 | 112 |
113 #endif // ASH_COMMON_SYSTEM_CHROMEOS_BLUETOOTH_TRAY_BLUETOOTH_HELPER_H_ | 113 #endif // ASH_COMMON_SYSTEM_CHROMEOS_BLUETOOTH_TRAY_BLUETOOTH_HELPER_H_ |
OLD | NEW |