OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
13 #include "device/bluetooth/bluetooth_adapter.h" | 13 #include "device/bluetooth/bluetooth_adapter.h" |
14 | 14 |
| 15 #ifdef __OBJC__ |
| 16 @class NSArray; |
| 17 #else |
| 18 class NSArray; |
| 19 #endif |
| 20 |
15 namespace base { | 21 namespace base { |
16 | 22 |
17 class SequencedTaskRunner; | 23 class SequencedTaskRunner; |
18 | 24 |
19 } // namespace base | 25 } // namespace base |
20 | 26 |
21 namespace device { | 27 namespace device { |
22 | 28 |
23 class BluetoothAdapterMacTest; | 29 class BluetoothAdapterMacTest; |
24 | 30 |
(...skipping 27 matching lines...) Expand all Loading... |
52 friend class BluetoothAdapterMacTest; | 58 friend class BluetoothAdapterMacTest; |
53 | 59 |
54 BluetoothAdapterMac(); | 60 BluetoothAdapterMac(); |
55 virtual ~BluetoothAdapterMac(); | 61 virtual ~BluetoothAdapterMac(); |
56 | 62 |
57 void TrackDefaultAdapter(); | 63 void TrackDefaultAdapter(); |
58 void TrackTestAdapter( | 64 void TrackTestAdapter( |
59 scoped_refptr<base::SequencedTaskRunner> ui_task_runner); | 65 scoped_refptr<base::SequencedTaskRunner> ui_task_runner); |
60 void PollAdapter(); | 66 void PollAdapter(); |
61 | 67 |
| 68 // Adds |devices| into |devices_| and notifies observers of the changes. |
| 69 // |devices| is an array of pointers to discovered or paired |
| 70 // |IOBluetoothDevice| objects. |
| 71 void AddDevices(NSArray* devices); |
| 72 |
| 73 // Removes devices that used to be paired but are unpaired by the system from |
| 74 // |devices_|. |
| 75 // |devices| is an array of pointers to paired |IOBluetoothDevice| objects. |
| 76 void RemoveUnpairedDevices(NSArray* paired_devices); |
| 77 |
62 bool powered_; | 78 bool powered_; |
63 | 79 |
64 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; | 80 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
65 | 81 |
66 // List of observers interested in event notifications from us. | 82 // List of observers interested in event notifications from us. |
67 ObserverList<BluetoothAdapter::Observer> observers_; | 83 ObserverList<BluetoothAdapter::Observer> observers_; |
68 | 84 |
69 base::WeakPtrFactory<BluetoothAdapterMac> weak_ptr_factory_; | 85 base::WeakPtrFactory<BluetoothAdapterMac> weak_ptr_factory_; |
70 | 86 |
71 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterMac); | 87 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterMac); |
72 }; | 88 }; |
73 | 89 |
74 } // namespace device | 90 } // namespace device |
75 | 91 |
76 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ | 92 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ |
OLD | NEW |