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

Unified Diff: device/bluetooth/bluetooth_adapter_factory.cc

Issue 2384463002: bluetooth: mac: Reject requestDevice promise if Mac version is <= 10.9 (Closed)
Patch Set: 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
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..2582d915b6ce156bc2948dfd216fbda979fd0a05 100644
--- a/device/bluetooth/bluetooth_adapter_factory.cc
+++ b/device/bluetooth/bluetooth_adapter_factory.cc
@@ -8,6 +8,7 @@
#include "base/bind.h"
#include "base/lazy_instance.h"
+#include "base/mac/mac_util.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "build/build_config.h"
@@ -63,6 +64,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) || \
ortuno 2016/10/04 03:20:24 We have a couple of issues to remove devices the u
François Beaufort 2016/10/04 10:00:22 So you want Web Bluetooth chooser to not show up o
ortuno 2016/10/04 21:23:16 Now that I think about it the only way to use Web
+ defined(OS_LINUX)
+ return true;
+#endif
+#if defined(OS_MACOSX)
ortuno 2016/10/04 03:20:24 nit: Could you combine this with the previous line
François Beaufort 2016/10/04 10:00:22 Done.
+ return base::mac::IsAtLeastOS10_10();
+#endif
ortuno 2016/10/04 03:20:24 nit: comment missing: // defined(OS_ANDROID) || de
François Beaufort 2016/10/04 10:00:22 Done.
+ return false;
+}
+
// static
void BluetoothAdapterFactory::GetAdapter(const AdapterCallback& callback) {
DCHECK(IsBluetoothAdapterAvailable());

Powered by Google App Engine
This is Rietveld 408576698