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

Unified Diff: device/bluetooth/bluetooth_adapter_factory.cc

Issue 2384463002: bluetooth: mac: Reject requestDevice promise if Mac version is <= 10.9 (Closed)
Patch Set: Add missing #if defined(OS_MACOSX) 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..0409648f59ee712735f555149b1585d7eac656dc 100644
--- a/device/bluetooth/bluetooth_adapter_factory.cc
+++ b/device/bluetooth/bluetooth_adapter_factory.cc
@@ -8,6 +8,9 @@
#include "base/bind.h"
#include "base/lazy_instance.h"
+#if defined(OS_MACOSX)
dcheng 2016/10/05 08:56:48 Nit: platform-specific includes guarded by conditi
+#include "base/mac/mac_util.h"
+#endif
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "build/build_config.h"
@@ -63,6 +66,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;
+}
+
// 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