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

Unified Diff: device/bluetooth/bluetooth_adapter_factory.cc

Issue 1367663002: Add Linux support for the Bluetooth API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor_dbus
Patch Set: rebase Created 5 years, 3 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_profile_bluez.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 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.
+#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())
« no previous file with comments | « device/bluetooth/bluetooth_adapter_factory.h ('k') | device/bluetooth/bluetooth_adapter_profile_bluez.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698