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

Unified Diff: device/bluetooth/bluetooth_adapter_factory.cc

Issue 2384463002: bluetooth: mac: Reject requestDevice promise if Mac version is <= 10.9 (Closed)
Patch Set: Fix nit Created 4 years, 2 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 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());
« 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