Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(932)

Unified Diff: device/bluetooth/bluetooth_adapter_factory.cc

Issue 2808353004: bluetooth: Rename Is*Available to Is*Supported (Closed)
Patch Set: Add const Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/bluetooth/bluetooth_adapter_factory.h ('k') | device/bluetooth/bluetooth_adapter_factory_wrapper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_adapter_factory.cc
diff --git a/device/bluetooth/bluetooth_adapter_factory.cc b/device/bluetooth/bluetooth_adapter_factory.cc
index ed64ecd2ee670bd91ed4328924455edf5de60f8b..8cf012837f6c30df79de98bb6fac291b8d53e636 100644
--- a/device/bluetooth/bluetooth_adapter_factory.cc
+++ b/device/bluetooth/bluetooth_adapter_factory.cc
@@ -16,6 +16,9 @@
#if defined(OS_MACOSX)
#include "base/mac/mac_util.h"
#endif
+#if defined(OS_WIN)
+#include "base/win/windows_version.h"
+#endif
namespace device {
@@ -54,7 +57,7 @@ void RunAdapterCallbacks() {
} // namespace
// static
-bool BluetoothAdapterFactory::IsBluetoothAdapterAvailable() {
+bool BluetoothAdapterFactory::IsBluetoothSupported() {
// 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())
@@ -68,27 +71,31 @@ bool BluetoothAdapterFactory::IsBluetoothAdapterAvailable() {
}
// static
-bool BluetoothAdapterFactory::IsLowEnergyAvailable() {
- DCHECK(IsBluetoothAdapterAvailable());
-
+bool BluetoothAdapterFactory::IsLowEnergySupported() {
// 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)
+
+#if defined(OS_ANDROID) && __ANDROID_API__ >= 23
return true;
+#elif defined(OS_WIN)
+ // Windows 8 supports Low Energy GATT operations but it does not support
+ // scanning, initiating connections and GATT Server. To keep the API
+ // consistent we consider Windows 8 as lacking Low Energy support.
+ return base::win::GetVersion() >= base::win::VERSION_WIN10;
#elif defined(OS_MACOSX)
return base::mac::IsAtLeastOS10_10();
+#elif defined(OS_LINUX) || defined(OS_CHROMEOS)
+ return true;
#else
return false;
-#endif // defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_WIN) ||
- // defined(OS_LINUX)
+#endif
}
// static
void BluetoothAdapterFactory::GetAdapter(const AdapterCallback& callback) {
- DCHECK(IsBluetoothAdapterAvailable());
+ DCHECK(IsBluetoothSupported());
#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS)
if (!default_adapter.Get()) {
« no previous file with comments | « device/bluetooth/bluetooth_adapter_factory.h ('k') | device/bluetooth/bluetooth_adapter_factory_wrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698