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