| 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 <map> | 8 #include <map> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 friend class BluetoothChromeOSTest_Shutdown_OnStartDiscoveryError_Test; | 163 friend class BluetoothChromeOSTest_Shutdown_OnStartDiscoveryError_Test; |
| 164 friend class BluetoothChromeOSTest_Shutdown_OnStopDiscovery_Test; | 164 friend class BluetoothChromeOSTest_Shutdown_OnStopDiscovery_Test; |
| 165 friend class BluetoothChromeOSTest_Shutdown_OnStopDiscoveryError_Test; | 165 friend class BluetoothChromeOSTest_Shutdown_OnStopDiscoveryError_Test; |
| 166 | 166 |
| 167 // typedef for callback parameters that are passed to AddDiscoverySession | 167 // typedef for callback parameters that are passed to AddDiscoverySession |
| 168 // and RemoveDiscoverySession. This is used to queue incoming requests while | 168 // and RemoveDiscoverySession. This is used to queue incoming requests while |
| 169 // a call to BlueZ is pending. | 169 // a call to BlueZ is pending. |
| 170 typedef std::pair<base::Closure, ErrorCallback> DiscoveryCallbackPair; | 170 typedef std::pair<base::Closure, ErrorCallback> DiscoveryCallbackPair; |
| 171 typedef std::queue<DiscoveryCallbackPair> DiscoveryCallbackQueue; | 171 typedef std::queue<DiscoveryCallbackPair> DiscoveryCallbackQueue; |
| 172 | 172 |
| 173 // Callback pair for the profile registration queue. |
| 174 typedef std::pair<base::Closure, ErrorCompletionCallback> |
| 175 RegisterProfileCompletionPair; |
| 176 |
| 173 BluetoothAdapterChromeOS(); | 177 BluetoothAdapterChromeOS(); |
| 174 ~BluetoothAdapterChromeOS() override; | 178 ~BluetoothAdapterChromeOS() override; |
| 175 | 179 |
| 176 // BluetoothAdapterClient::Observer override. | 180 // BluetoothAdapterClient::Observer override. |
| 177 void AdapterAdded(const dbus::ObjectPath& object_path) override; | 181 void AdapterAdded(const dbus::ObjectPath& object_path) override; |
| 178 void AdapterRemoved(const dbus::ObjectPath& object_path) override; | 182 void AdapterRemoved(const dbus::ObjectPath& object_path) override; |
| 179 void AdapterPropertyChanged(const dbus::ObjectPath& object_path, | 183 void AdapterPropertyChanged(const dbus::ObjectPath& object_path, |
| 180 const std::string& property_name) override; | 184 const std::string& property_name) override; |
| 181 | 185 |
| 182 // BluetoothDeviceClient::Observer override. | 186 // BluetoothDeviceClient::Observer override. |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 // our own class as its delegate. | 347 // our own class as its delegate. |
| 344 scoped_ptr<BluetoothAgentServiceProvider> agent_; | 348 scoped_ptr<BluetoothAgentServiceProvider> agent_; |
| 345 | 349 |
| 346 // UI thread task runner and socket thread object used to create sockets. | 350 // UI thread task runner and socket thread object used to create sockets. |
| 347 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; | 351 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
| 348 scoped_refptr<device::BluetoothSocketThread> socket_thread_; | 352 scoped_refptr<device::BluetoothSocketThread> socket_thread_; |
| 349 | 353 |
| 350 // The profiles we have registered with the bluetooth daemon. | 354 // The profiles we have registered with the bluetooth daemon. |
| 351 std::map<device::BluetoothUUID, BluetoothAdapterProfileChromeOS*> profiles_; | 355 std::map<device::BluetoothUUID, BluetoothAdapterProfileChromeOS*> profiles_; |
| 352 | 356 |
| 353 // Callback pair for the profile registration queue. | |
| 354 typedef std::pair<base::Closure, ErrorCompletionCallback> | |
| 355 RegisterProfileCompletionPair; | |
| 356 | |
| 357 // Queue of delegates waiting for a profile to register. | 357 // Queue of delegates waiting for a profile to register. |
| 358 std::map<device::BluetoothUUID, std::vector<RegisterProfileCompletionPair>*> | 358 std::map<device::BluetoothUUID, std::vector<RegisterProfileCompletionPair>*> |
| 359 profile_queues_; | 359 profile_queues_; |
| 360 | 360 |
| 361 // Note: This should remain the last member so it'll be destroyed and | 361 // Note: This should remain the last member so it'll be destroyed and |
| 362 // invalidate its weak pointers before any other members are destroyed. | 362 // invalidate its weak pointers before any other members are destroyed. |
| 363 base::WeakPtrFactory<BluetoothAdapterChromeOS> weak_ptr_factory_; | 363 base::WeakPtrFactory<BluetoothAdapterChromeOS> weak_ptr_factory_; |
| 364 | 364 |
| 365 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterChromeOS); | 365 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterChromeOS); |
| 366 }; | 366 }; |
| 367 | 367 |
| 368 } // namespace chromeos | 368 } // namespace chromeos |
| 369 | 369 |
| 370 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ | 370 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ |
| OLD | NEW |