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

Unified Diff: device/bluetooth/bluetooth_adapter_factory.cc

Issue 1415573014: Reland "Add Linux support for the Bluetooth API" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build fix. Created 5 years, 1 month 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 c3e6d5cffd975c00a0372a1451bf8702fc08cb8f..977143982708e750916b12c3b2b34e4d73e599e1 100644
--- a/device/bluetooth/bluetooth_adapter_factory.cc
+++ b/device/bluetooth/bluetooth_adapter_factory.cc
@@ -12,8 +12,8 @@
#include "base/memory/weak_ptr.h"
#include "device/bluetooth/bluetooth_adapter.h"
-#if defined(OS_CHROMEOS)
-#include "device/bluetooth/bluetooth_adapter_chromeos.h"
+#if defined(OS_CHROMEOS) || defined(OS_LINUX)
+#include "device/bluetooth/bluetooth_adapter_bluez.h"
#endif
#if defined(OS_MACOSX)
@@ -62,6 +62,8 @@ bool BluetoothAdapterFactory::IsBluetoothAdapterAvailable() {
// instance even on platforms that would otherwise not support it.
if (default_adapter.Get())
return true;
+// Even though the adapter is available on Linux, we only want to use it for
+// the Chrome API, which is why defines(OS_LINUX) is missing from here.
#if defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_WIN)
return true;
#elif defined(OS_MACOSX)
@@ -73,7 +75,12 @@ bool BluetoothAdapterFactory::IsBluetoothAdapterAvailable() {
// static
void BluetoothAdapterFactory::GetAdapter(const AdapterCallback& callback) {
+// TODO(rkc): This is a very slight hack to allow us to be able to create
+// an adapter on Linux, 'without' exposing the adapter to all Bluetooth
+// services within the browser.
ortuno 2015/11/06 18:15:41 So what's the plan for removing this TODO? Could y
rkc 2015/11/25 00:48:16 I don't have one currently. This would be somethin
+#if !defined(OS_LINUX)
DCHECK(IsBluetoothAdapterAvailable());
+#endif
#if defined(OS_WIN)
if (!default_adapter.Get()) {
@@ -98,7 +105,7 @@ void BluetoothAdapterFactory::GetAdapter(const AdapterCallback& callback) {
}
-#if defined(OS_CHROMEOS)
+#if defined(OS_CHROMEOS) || defined(OS_LINUX)
// static
void BluetoothAdapterFactory::Shutdown() {
if (default_adapter.Get())

Powered by Google App Engine
This is Rietveld 408576698