Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_FACTORY_WRAPPER_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_FACTORY_WRAPPER_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_FACTORY_WRAPPER_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_FACTORY_WRAPPER_H_ |
| 7 | 7 |
| 8 #include <unordered_set> | 8 #include <unordered_set> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 typedef base::Callback<void(BluetoothAdapter*)> AcquireAdapterCallback; | 26 typedef base::Callback<void(BluetoothAdapter*)> AcquireAdapterCallback; |
| 27 | 27 |
| 28 ~BluetoothAdapterFactoryWrapper(); | 28 ~BluetoothAdapterFactoryWrapper(); |
| 29 | 29 |
| 30 static BluetoothAdapterFactoryWrapper& Get(); | 30 static BluetoothAdapterFactoryWrapper& Get(); |
| 31 | 31 |
| 32 // Returns true if the platform supports Bluetooth or if | 32 // Returns true if the platform supports Bluetooth or if |
| 33 // SetBluetoothAdapterForTesting has been called. | 33 // SetBluetoothAdapterForTesting has been called. |
| 34 bool IsBluetoothAdapterAvailable(); | 34 bool IsBluetoothAdapterAvailable(); |
| 35 | 35 |
| 36 // Returns true if the platform supports Bluetooth Low Energy or if | |
| 37 // SetBluetoothAdapterForTesting has been called. | |
| 38 bool IsLowEnergyAvailable(); | |
|
ortuno
2016/10/04 03:20:24
We no longer need IsBluetoothAdapterAvailable; rep
François Beaufort
2016/10/04 10:00:22
Done.
| |
| 39 | |
| 36 // Adds |observer| to the set of adapter observers. If another observer has | 40 // Adds |observer| to the set of adapter observers. If another observer has |
| 37 // acquired the adapter in the past it adds |observer| as an observer to that | 41 // acquired the adapter in the past it adds |observer| as an observer to that |
| 38 // adapter, otherwise it gets a new adapter and adds |observer| to it. Runs | 42 // adapter, otherwise it gets a new adapter and adds |observer| to it. Runs |
| 39 // |callback| with the adapter |observer| has been added to. | 43 // |callback| with the adapter |observer| has been added to. |
| 40 void AcquireAdapter(BluetoothAdapter::Observer* observer, | 44 void AcquireAdapter(BluetoothAdapter::Observer* observer, |
| 41 const AcquireAdapterCallback& callback); | 45 const AcquireAdapterCallback& callback); |
| 42 // Removes |observer| from the list of adapter observers if |observer| | 46 // Removes |observer| from the list of adapter observers if |observer| |
| 43 // has acquired the adapter in the past. If there are no more observers | 47 // has acquired the adapter in the past. If there are no more observers |
| 44 // it deletes the reference to the adapter. | 48 // it deletes the reference to the adapter. |
| 45 void ReleaseAdapter(BluetoothAdapter::Observer* observer); | 49 void ReleaseAdapter(BluetoothAdapter::Observer* observer); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 // Note: This should remain the last member so it'll be destroyed and | 91 // Note: This should remain the last member so it'll be destroyed and |
| 88 // invalidate its weak pointers before any other members are destroyed. | 92 // invalidate its weak pointers before any other members are destroyed. |
| 89 base::WeakPtrFactory<BluetoothAdapterFactoryWrapper> weak_ptr_factory_; | 93 base::WeakPtrFactory<BluetoothAdapterFactoryWrapper> weak_ptr_factory_; |
| 90 | 94 |
| 91 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterFactoryWrapper); | 95 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterFactoryWrapper); |
| 92 }; | 96 }; |
| 93 | 97 |
| 94 } // namespace device | 98 } // namespace device |
| 95 | 99 |
| 96 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_FACTORY_WRAPPER_H_ | 100 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_FACTORY_WRAPPER_H_ |
| OLD | NEW |