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_CHROMEOS_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/sequenced_task_runner.h" | 14 #include "base/sequenced_task_runner.h" |
15 #include "chromeos/dbus/bluetooth_adapter_client.h" | 15 #include "chromeos/dbus/bluetooth_adapter_client.h" |
16 #include "chromeos/dbus/bluetooth_agent_service_provider.h" | 16 #include "chromeos/dbus/bluetooth_agent_service_provider.h" |
17 #include "chromeos/dbus/bluetooth_device_client.h" | 17 #include "chromeos/dbus/bluetooth_device_client.h" |
18 #include "chromeos/dbus/bluetooth_input_client.h" | 18 #include "chromeos/dbus/bluetooth_input_client.h" |
19 #include "dbus/object_path.h" | 19 #include "dbus/object_path.h" |
20 #include "device/bluetooth/bluetooth_adapter.h" | 20 #include "device/bluetooth/bluetooth_adapter.h" |
21 #include "device/bluetooth/bluetooth_audio_sink.h" | 21 #include "device/bluetooth/bluetooth_audio_sink.h" |
22 #include "device/bluetooth/bluetooth_audio_sink_chromeos.h" | |
22 #include "device/bluetooth/bluetooth_device.h" | 23 #include "device/bluetooth/bluetooth_device.h" |
23 #include "device/bluetooth/bluetooth_export.h" | 24 #include "device/bluetooth/bluetooth_export.h" |
24 | 25 |
25 namespace device { | 26 namespace device { |
26 class BluetoothSocketThread; | 27 class BluetoothSocketThread; |
27 } // namespace device | 28 } // namespace device |
28 | 29 |
29 namespace chromeos { | 30 namespace chromeos { |
30 | 31 |
32 class BluetoothAudioSinkChromeOS; | |
31 class BluetoothChromeOSTest; | 33 class BluetoothChromeOSTest; |
32 class BluetoothDeviceChromeOS; | 34 class BluetoothDeviceChromeOS; |
33 class BluetoothPairingChromeOS; | 35 class BluetoothPairingChromeOS; |
34 class BluetoothRemoteGattCharacteristicChromeOS; | 36 class BluetoothRemoteGattCharacteristicChromeOS; |
35 class BluetoothRemoteGattDescriptorChromeOS; | 37 class BluetoothRemoteGattDescriptorChromeOS; |
36 class BluetoothRemoteGattServiceChromeOS; | 38 class BluetoothRemoteGattServiceChromeOS; |
37 | 39 |
38 // The BluetoothAdapterChromeOS class implements BluetoothAdapter for the | 40 // The BluetoothAdapterChromeOS class implements BluetoothAdapter for the |
39 // Chrome OS platform. | 41 // Chrome OS platform. |
40 class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS | 42 class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 const dbus::ObjectPath& object_path() const { return object_path_; } | 118 const dbus::ObjectPath& object_path() const { return object_path_; } |
117 | 119 |
118 protected: | 120 protected: |
119 // BluetoothAdapter: | 121 // BluetoothAdapter: |
120 void RemovePairingDelegateInternal( | 122 void RemovePairingDelegateInternal( |
121 device::BluetoothDevice::PairingDelegate* pairing_delegate) override; | 123 device::BluetoothDevice::PairingDelegate* pairing_delegate) override; |
122 | 124 |
123 private: | 125 private: |
124 friend class base::DeleteHelper<BluetoothAdapterChromeOS>; | 126 friend class base::DeleteHelper<BluetoothAdapterChromeOS>; |
125 friend class BluetoothChromeOSTest; | 127 friend class BluetoothChromeOSTest; |
128 friend class BluetoothAudioSinkChromeOSTest; | |
armansito
2015/01/27 04:38:05
Is the friendship really necessary?
| |
126 | 129 |
127 // typedef for callback parameters that are passed to AddDiscoverySession | 130 // typedef for callback parameters that are passed to AddDiscoverySession |
128 // and RemoveDiscoverySession. This is used to queue incoming requests while | 131 // and RemoveDiscoverySession. This is used to queue incoming requests while |
129 // a call to BlueZ is pending. | 132 // a call to BlueZ is pending. |
130 typedef std::pair<base::Closure, ErrorCallback> DiscoveryCallbackPair; | 133 typedef std::pair<base::Closure, ErrorCallback> DiscoveryCallbackPair; |
131 typedef std::queue<DiscoveryCallbackPair> DiscoveryCallbackQueue; | 134 typedef std::queue<DiscoveryCallbackPair> DiscoveryCallbackQueue; |
132 | 135 |
133 BluetoothAdapterChromeOS(); | 136 BluetoothAdapterChromeOS(); |
134 ~BluetoothAdapterChromeOS() override; | 137 ~BluetoothAdapterChromeOS() override; |
135 | 138 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 void OnRegisterAgent(); | 178 void OnRegisterAgent(); |
176 void OnRegisterAgentError(const std::string& error_name, | 179 void OnRegisterAgentError(const std::string& error_name, |
177 const std::string& error_message); | 180 const std::string& error_message); |
178 | 181 |
179 // Called by dbus:: on completion of the D-Bus method call to request that | 182 // Called by dbus:: on completion of the D-Bus method call to request that |
180 // the pairing agent be made the default. | 183 // the pairing agent be made the default. |
181 void OnRequestDefaultAgent(); | 184 void OnRequestDefaultAgent(); |
182 void OnRequestDefaultAgentError(const std::string& error_name, | 185 void OnRequestDefaultAgentError(const std::string& error_name, |
183 const std::string& error_message); | 186 const std::string& error_message); |
184 | 187 |
188 // Called by BluetoothAudioSinkChromeOS on completion of registering an audio | |
189 // sink. | |
190 void OnRegisterAudioSink( | |
191 const device::BluetoothAdapter::AcquiredCallback& callback, | |
192 scoped_refptr<device::BluetoothAudioSink> audio_sink); | |
193 | |
185 // Internal method to obtain a BluetoothPairingChromeOS object for the device | 194 // Internal method to obtain a BluetoothPairingChromeOS object for the device |
186 // with path |object_path|. Returns the existing pairing object if the device | 195 // with path |object_path|. Returns the existing pairing object if the device |
187 // already has one (usually an outgoing connection in progress) or a new | 196 // already has one (usually an outgoing connection in progress) or a new |
188 // pairing object with the default pairing delegate if not. If no default | 197 // pairing object with the default pairing delegate if not. If no default |
189 // pairing object exists, NULL will be returned. | 198 // pairing object exists, NULL will be returned. |
190 BluetoothPairingChromeOS* GetPairing(const dbus::ObjectPath& object_path); | 199 BluetoothPairingChromeOS* GetPairing(const dbus::ObjectPath& object_path); |
191 | 200 |
192 // Set the tracked adapter to the one in |object_path|, this object will | 201 // Set the tracked adapter to the one in |object_path|, this object will |
193 // subsequently operate on that adapter until it is removed. | 202 // subsequently operate on that adapter until it is removed. |
194 void SetAdapter(const dbus::ObjectPath& object_path); | 203 void SetAdapter(const dbus::ObjectPath& object_path); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
278 // Note: This should remain the last member so it'll be destroyed and | 287 // Note: This should remain the last member so it'll be destroyed and |
279 // invalidate its weak pointers before any other members are destroyed. | 288 // invalidate its weak pointers before any other members are destroyed. |
280 base::WeakPtrFactory<BluetoothAdapterChromeOS> weak_ptr_factory_; | 289 base::WeakPtrFactory<BluetoothAdapterChromeOS> weak_ptr_factory_; |
281 | 290 |
282 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterChromeOS); | 291 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterChromeOS); |
283 }; | 292 }; |
284 | 293 |
285 } // namespace chromeos | 294 } // namespace chromeos |
286 | 295 |
287 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ | 296 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ |
OLD | NEW |