Chromium Code Reviews| Index: device/bluetooth/bluetooth_adapter_factory.cc |
| diff --git a/device/bluetooth/bluetooth_adapter_factory.cc b/device/bluetooth/bluetooth_adapter_factory.cc |
| index 61aa3dc7a6abb83efac1f7bcc609e95f122d3e4b..3403b1a3cd1d7cc31465d4e42dae3a0942389174 100644 |
| --- a/device/bluetooth/bluetooth_adapter_factory.cc |
| +++ b/device/bluetooth/bluetooth_adapter_factory.cc |
| @@ -13,6 +13,10 @@ |
| #include "build/build_config.h" |
| #include "device/bluetooth/bluetooth_adapter.h" |
| +#if defined(OS_MACOSX) |
| +#include "base/mac/mac_util.h" |
| +#endif |
| + |
| namespace device { |
| namespace { |
| @@ -63,6 +67,24 @@ bool BluetoothAdapterFactory::IsBluetoothAdapterAvailable() { |
| #endif |
| } |
| +// static |
| +bool BluetoothAdapterFactory::IsLowEnergyAvailable() { |
| + DCHECK(IsBluetoothAdapterAvailable()); |
| + |
| + // SetAdapterForTesting() may be used to provide a test or mock adapter |
| + // instance even on platforms that would otherwise not support it. |
| + if (default_adapter.Get()) |
| + return true; |
| +#if defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_WIN) || \ |
| + defined(OS_LINUX) |
| + return true; |
| +#elif defined(OS_MACOSX) |
| + return base::mac::IsAtLeastOS10_10(); |
| +#endif // defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_WIN) || |
| + // defined(OS_LINUX) |
| + return false; |
|
sdefresne
2016/10/05 11:08:30
The above will expand to the following when OS_WIN
|
| +} |
| + |
| // static |
| void BluetoothAdapterFactory::GetAdapter(const AdapterCallback& callback) { |
| DCHECK(IsBluetoothAdapterAvailable()); |