| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 // asynchronous initialization is complete. | 203 // asynchronous initialization is complete. |
| 204 // Caution: The returned pointer also transfers ownership of the adapter. The | 204 // Caution: The returned pointer also transfers ownership of the adapter. The |
| 205 // caller is expected to call |AddRef()| on the returned pointer, typically by | 205 // caller is expected to call |AddRef()| on the returned pointer, typically by |
| 206 // storing it into a |scoped_refptr|. | 206 // storing it into a |scoped_refptr|. |
| 207 static base::WeakPtr<BluetoothAdapter> CreateAdapter( | 207 static base::WeakPtr<BluetoothAdapter> CreateAdapter( |
| 208 const InitCallback& init_callback); | 208 const InitCallback& init_callback); |
| 209 | 209 |
| 210 // Returns a weak pointer to an existing adapter for testing purposes only. | 210 // Returns a weak pointer to an existing adapter for testing purposes only. |
| 211 base::WeakPtr<BluetoothAdapter> GetWeakPtrForTesting(); | 211 base::WeakPtr<BluetoothAdapter> GetWeakPtrForTesting(); |
| 212 | 212 |
| 213 #if defined(OS_CHROMEOS) | 213 #if defined(OS_CHROMEOS) || defined(OS_LINUX) |
| 214 // Shutdown the adapter: tear down and clean up all objects owned by | 214 // Shutdown the adapter: tear down and clean up all objects owned by |
| 215 // BluetoothAdapter. After this call, the BluetoothAdapter will behave as if | 215 // BluetoothAdapter. After this call, the BluetoothAdapter will behave as if |
| 216 // no Bluetooth controller exists in the local system. |IsPresent| will return | 216 // no Bluetooth controller exists in the local system. |IsPresent| will return |
| 217 // false. | 217 // false. |
| 218 virtual void Shutdown(); | 218 virtual void Shutdown(); |
| 219 #endif | 219 #endif |
| 220 | 220 |
| 221 // Adds and removes observers for events on this bluetooth adapter. If | 221 // Adds and removes observers for events on this bluetooth adapter. If |
| 222 // monitoring multiple adapters, check the |adapter| parameter of observer | 222 // monitoring multiple adapters, check the |adapter| parameter of observer |
| 223 // methods to determine which adapter is issuing the event. | 223 // methods to determine which adapter is issuing the event. |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 std::set<BluetoothDiscoverySession*> discovery_sessions_; | 510 std::set<BluetoothDiscoverySession*> discovery_sessions_; |
| 511 | 511 |
| 512 // Note: This should remain the last member so it'll be destroyed and | 512 // Note: This should remain the last member so it'll be destroyed and |
| 513 // invalidate its weak pointers before any other members are destroyed. | 513 // invalidate its weak pointers before any other members are destroyed. |
| 514 base::WeakPtrFactory<BluetoothAdapter> weak_ptr_factory_; | 514 base::WeakPtrFactory<BluetoothAdapter> weak_ptr_factory_; |
| 515 }; | 515 }; |
| 516 | 516 |
| 517 } // namespace device | 517 } // namespace device |
| 518 | 518 |
| 519 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ | 519 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
| OLD | NEW |