| 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 <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 // asynchronous initialization is complete. | 214 // asynchronous initialization is complete. |
| 215 // Caution: The returned pointer also transfers ownership of the adapter. The | 215 // Caution: The returned pointer also transfers ownership of the adapter. The |
| 216 // caller is expected to call |AddRef()| on the returned pointer, typically by | 216 // caller is expected to call |AddRef()| on the returned pointer, typically by |
| 217 // storing it into a |scoped_refptr|. | 217 // storing it into a |scoped_refptr|. |
| 218 static base::WeakPtr<BluetoothAdapter> CreateAdapter( | 218 static base::WeakPtr<BluetoothAdapter> CreateAdapter( |
| 219 const InitCallback& init_callback); | 219 const InitCallback& init_callback); |
| 220 | 220 |
| 221 // Returns a weak pointer to an existing adapter for testing purposes only. | 221 // Returns a weak pointer to an existing adapter for testing purposes only. |
| 222 base::WeakPtr<BluetoothAdapter> GetWeakPtrForTesting(); | 222 base::WeakPtr<BluetoothAdapter> GetWeakPtrForTesting(); |
| 223 | 223 |
| 224 #if defined(OS_CHROMEOS) | 224 #if defined(OS_CHROMEOS) || defined(OS_LINUX) |
| 225 // Shutdown the adapter: tear down and clean up all objects owned by | 225 // Shutdown the adapter: tear down and clean up all objects owned by |
| 226 // BluetoothAdapter. After this call, the BluetoothAdapter will behave as if | 226 // BluetoothAdapter. After this call, the BluetoothAdapter will behave as if |
| 227 // no Bluetooth controller exists in the local system. |IsPresent| will return | 227 // no Bluetooth controller exists in the local system. |IsPresent| will return |
| 228 // false. | 228 // false. |
| 229 virtual void Shutdown(); | 229 virtual void Shutdown(); |
| 230 #endif | 230 #endif |
| 231 | 231 |
| 232 // Adds and removes observers for events on this bluetooth adapter. If | 232 // Adds and removes observers for events on this bluetooth adapter. If |
| 233 // monitoring multiple adapters, check the |adapter| parameter of observer | 233 // monitoring multiple adapters, check the |adapter| parameter of observer |
| 234 // methods to determine which adapter is issuing the event. | 234 // methods to determine which adapter is issuing the event. |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 std::set<BluetoothDiscoverySession*> discovery_sessions_; | 525 std::set<BluetoothDiscoverySession*> discovery_sessions_; |
| 526 | 526 |
| 527 // Note: This should remain the last member so it'll be destroyed and | 527 // Note: This should remain the last member so it'll be destroyed and |
| 528 // invalidate its weak pointers before any other members are destroyed. | 528 // invalidate its weak pointers before any other members are destroyed. |
| 529 base::WeakPtrFactory<BluetoothAdapter> weak_ptr_factory_; | 529 base::WeakPtrFactory<BluetoothAdapter> weak_ptr_factory_; |
| 530 }; | 530 }; |
| 531 | 531 |
| 532 } // namespace device | 532 } // namespace device |
| 533 | 533 |
| 534 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ | 534 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
| OLD | NEW |