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

Unified Diff: device/bluetooth/bluetooth_adapter_bluez.h

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_bluez.h
diff --git a/device/bluetooth/bluetooth_adapter_chromeos.h b/device/bluetooth/bluetooth_adapter_bluez.h
similarity index 83%
rename from device/bluetooth/bluetooth_adapter_chromeos.h
rename to device/bluetooth/bluetooth_adapter_bluez.h
index 53b271f6ef9225a0c23874608df45d051a28091a..e5bf14670a198a9fec48aee4d16092973faf70d0 100644
--- a/device/bluetooth/bluetooth_adapter_chromeos.h
+++ b/device/bluetooth/bluetooth_adapter_bluez.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_
-#define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_
+#ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_BLUEZ_H_
+#define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_BLUEZ_H_
#include <map>
#include <queue>
@@ -11,6 +11,7 @@
#include <utility>
#include <vector>
+#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "dbus/object_path.h"
#include "device/bluetooth/bluetooth_adapter.h"
@@ -33,17 +34,17 @@ namespace device {
class BluetoothSocketThread;
} // namespace device
-namespace chromeos {
+namespace bluez {
-class BluetoothChromeOSTest;
-class BluetoothAdapterProfileChromeOS;
-class BluetoothDeviceChromeOS;
-class BluetoothPairingChromeOS;
-class BluetoothRemoteGattCharacteristicChromeOS;
-class BluetoothRemoteGattDescriptorChromeOS;
-class BluetoothRemoteGattServiceChromeOS;
+class BluetoothBlueZTest;
+class BluetoothAdapterProfileBlueZ;
+class BluetoothDeviceBlueZ;
+class BluetoothPairingBlueZ;
+class BluetoothRemoteGattCharacteristicBlueZ;
+class BluetoothRemoteGattDescriptorBlueZ;
+class BluetoothRemoteGattServiceBlueZ;
-// The BluetoothAdapterChromeOS class implements BluetoothAdapter for the
+// The BluetoothAdapterBlueZ class implements BluetoothAdapter for the
// Chrome OS platform.
ortuno 2015/11/06 18:15:41 Leftover reference to Chrome OS.
rkc 2015/11/25 00:48:16 Done.
//
// All methods are called from the dbus origin / UI thread and are generally
@@ -52,13 +53,13 @@ class BluetoothRemoteGattServiceChromeOS;
// This class interacts with sockets using the BluetoothSocketThread to ensure
// single-threaded calls, and posts tasks to the UI thread.
//
-// Methods tolerate a shutdown scenario where BluetoothAdapterChromeOS::Shutdown
+// Methods tolerate a shutdown scenario where BluetoothAdapterBlueZ::Shutdown
// causes IsPresent to return false just before the dbus system is shutdown but
-// while references to the BluetoothAdapterChromeOS object still exists.
+// while references to the BluetoothAdapterBlueZ object still exists.
//
// When adding methods to this class verify shutdown behavior in
-// BluetoothChromeOSTest, Shutdown.
-class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
+// BluetoothBlueZTest, Shutdown.
+class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterBlueZ
: public device::BluetoothAdapter,
public bluez::BluetoothAdapterClient::Observer,
public bluez::BluetoothDeviceClient::Observer,
@@ -67,7 +68,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
public:
typedef base::Callback<void(const std::string& error_message)>
ErrorCompletionCallback;
- typedef base::Callback<void(BluetoothAdapterProfileChromeOS* profile)>
+ typedef base::Callback<void(BluetoothAdapterProfileBlueZ* profile)>
ProfileRegisteredCallback;
static base::WeakPtr<BluetoothAdapter> CreateAdapter();
@@ -112,37 +113,36 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
// Locates the device object by object path (the devices map and
// BluetoothDevice methods are by address).
- BluetoothDeviceChromeOS* GetDeviceWithPath(
- const dbus::ObjectPath& object_path);
+ BluetoothDeviceBlueZ* GetDeviceWithPath(const dbus::ObjectPath& object_path);
// Announces to observers a change in device state that is not reflected by
// its D-Bus properties. |device| is owned by the caller and cannot be NULL.
- void NotifyDeviceChanged(BluetoothDeviceChromeOS* device);
+ void NotifyDeviceChanged(BluetoothDeviceBlueZ* device);
// Announce to observers a device address change.
- void NotifyDeviceAddressChanged(BluetoothDeviceChromeOS* device,
+ void NotifyDeviceAddressChanged(BluetoothDeviceBlueZ* device,
const std::string& old_address);
// The following methods are used to send various GATT observer events to
// observers.
- void NotifyGattServiceAdded(BluetoothRemoteGattServiceChromeOS* service);
- void NotifyGattServiceRemoved(BluetoothRemoteGattServiceChromeOS* service);
- void NotifyGattServiceChanged(BluetoothRemoteGattServiceChromeOS* service);
- void NotifyGattServicesDiscovered(BluetoothDeviceChromeOS* device);
- void NotifyGattDiscoveryComplete(BluetoothRemoteGattServiceChromeOS* service);
+ void NotifyGattServiceAdded(BluetoothRemoteGattServiceBlueZ* service);
+ void NotifyGattServiceRemoved(BluetoothRemoteGattServiceBlueZ* service);
+ void NotifyGattServiceChanged(BluetoothRemoteGattServiceBlueZ* service);
+ void NotifyGattServicesDiscovered(BluetoothDeviceBlueZ* device);
+ void NotifyGattDiscoveryComplete(BluetoothRemoteGattServiceBlueZ* service);
void NotifyGattCharacteristicAdded(
- BluetoothRemoteGattCharacteristicChromeOS* characteristic);
+ BluetoothRemoteGattCharacteristicBlueZ* characteristic);
void NotifyGattCharacteristicRemoved(
- BluetoothRemoteGattCharacteristicChromeOS* characteristic);
+ BluetoothRemoteGattCharacteristicBlueZ* characteristic);
void NotifyGattDescriptorAdded(
- BluetoothRemoteGattDescriptorChromeOS* descriptor);
+ BluetoothRemoteGattDescriptorBlueZ* descriptor);
void NotifyGattDescriptorRemoved(
- BluetoothRemoteGattDescriptorChromeOS* descriptor);
+ BluetoothRemoteGattDescriptorBlueZ* descriptor);
void NotifyGattCharacteristicValueChanged(
- BluetoothRemoteGattCharacteristicChromeOS* characteristic,
+ BluetoothRemoteGattCharacteristicBlueZ* characteristic,
const std::vector<uint8>& value);
void NotifyGattDescriptorValueChanged(
- BluetoothRemoteGattDescriptorChromeOS* descriptor,
+ BluetoothRemoteGattDescriptorBlueZ* descriptor,
const std::vector<uint8>& value);
// Returns the object path of the adapter.
@@ -153,7 +153,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
// If |device_path| is the empty string, incoming connections will be
// assigned to |delegate|. When the profile is
// successfully registered, |success_callback| will be called with a pointer
- // to the profile which is managed by BluetoothAdapterChromeOS. On failure,
+ // to the profile which is managed by BluetoothAdapterBlueZ. On failure,
// |error_callback| will be called.
void UseProfile(const device::BluetoothUUID& uuid,
const dbus::ObjectPath& device_path,
@@ -164,7 +164,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
// Release use of a profile by a device.
void ReleaseProfile(const dbus::ObjectPath& device_path,
- BluetoothAdapterProfileChromeOS* profile);
+ BluetoothAdapterProfileBlueZ* profile);
protected:
// BluetoothAdapter:
@@ -172,12 +172,12 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
device::BluetoothDevice::PairingDelegate* pairing_delegate) override;
private:
- friend class BluetoothChromeOSTest;
- friend class BluetoothChromeOSTest_Shutdown_Test;
- friend class BluetoothChromeOSTest_Shutdown_OnStartDiscovery_Test;
- friend class BluetoothChromeOSTest_Shutdown_OnStartDiscoveryError_Test;
- friend class BluetoothChromeOSTest_Shutdown_OnStopDiscovery_Test;
- friend class BluetoothChromeOSTest_Shutdown_OnStopDiscoveryError_Test;
+ friend class BluetoothBlueZTest;
+ friend class BluetoothBlueZTest_Shutdown_Test;
+ friend class BluetoothBlueZTest_Shutdown_OnStartDiscovery_Test;
+ friend class BluetoothBlueZTest_Shutdown_OnStartDiscoveryError_Test;
+ friend class BluetoothBlueZTest_Shutdown_OnStopDiscovery_Test;
+ friend class BluetoothBlueZTest_Shutdown_OnStopDiscoveryError_Test;
// typedef for callback parameters that are passed to AddDiscoverySession
// and RemoveDiscoverySession. This is used to queue incoming requests while
@@ -191,8 +191,8 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
typedef std::pair<base::Closure, ErrorCompletionCallback>
RegisterProfileCompletionPair;
- BluetoothAdapterChromeOS();
- ~BluetoothAdapterChromeOS() override;
+ BluetoothAdapterBlueZ();
+ ~BluetoothAdapterBlueZ() override;
// bluez::BluetoothAdapterClient::Observer override.
void AdapterAdded(const dbus::ObjectPath& object_path) override;
@@ -243,19 +243,19 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
void OnRequestDefaultAgentError(const std::string& error_name,
const std::string& error_message);
- // Called by BluetoothAudioSinkChromeOS on completion of registering an audio
+ // Called by BluetoothAudioSinkBlueZ on completion of registering an audio
// sink.
void OnRegisterAudioSink(
const device::BluetoothAdapter::AcquiredCallback& callback,
const device::BluetoothAudioSink::ErrorCallback& error_callback,
scoped_refptr<device::BluetoothAudioSink> audio_sink);
- // Internal method to obtain a BluetoothPairingChromeOS object for the device
+ // Internal method to obtain a BluetoothPairingBlueZ object for the device
// with path |object_path|. Returns the existing pairing object if the device
// already has one (usually an outgoing connection in progress) or a new
// pairing object with the default pairing delegate if not. If no default
// pairing object exists, NULL will be returned.
- BluetoothPairingChromeOS* GetPairing(const dbus::ObjectPath& object_path);
+ BluetoothPairingBlueZ* GetPairing(const dbus::ObjectPath& object_path);
// Set the tracked adapter to the one in |object_path|, this object will
// subsequently operate on that adapter until it is removed.
@@ -331,7 +331,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
// Called by dbus:: on completion of the D-Bus method to register a profile.
void OnRegisterProfile(const device::BluetoothUUID& uuid,
- scoped_ptr<BluetoothAdapterProfileChromeOS> profile);
+ scoped_ptr<BluetoothAdapterProfileBlueZ> profile);
void SetProfileDelegate(
const device::BluetoothUUID& uuid,
@@ -343,7 +343,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
const std::string& error_name,
const std::string& error_message);
- // Called by BluetoothAdapterProfileChromeOS when no users of a profile
+ // Called by BluetoothAdapterProfileBlueZ when no users of a profile
// remain.
void RemoveProfile(const device::BluetoothUUID& uuid);
@@ -385,7 +385,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
scoped_refptr<device::BluetoothSocketThread> socket_thread_;
// The profiles we have registered with the bluetooth daemon.
- std::map<device::BluetoothUUID, BluetoothAdapterProfileChromeOS*> profiles_;
+ std::map<device::BluetoothUUID, BluetoothAdapterProfileBlueZ*> profiles_;
// Queue of delegates waiting for a profile to register.
std::map<device::BluetoothUUID, std::vector<RegisterProfileCompletionPair>*>
@@ -395,11 +395,11 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
// Note: This should remain the last member so it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.
- base::WeakPtrFactory<BluetoothAdapterChromeOS> weak_ptr_factory_;
+ base::WeakPtrFactory<BluetoothAdapterBlueZ> weak_ptr_factory_;
- DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterChromeOS);
+ DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterBlueZ);
};
-} // namespace chromeos
+} // namespace bluez
-#endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_
+#endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_BLUEZ_H_

Powered by Google App Engine
This is Rietveld 408576698