| Index: device/bluetooth/bluetooth_adapter_experimental_chromeos.h
|
| diff --git a/device/bluetooth/bluetooth_adapter_experimental_chromeos.h b/device/bluetooth/bluetooth_adapter_experimental_chromeos.h
|
| index 137935215d20324203f17afd185faf9a5ead300f..8471b0fe5d4b9a71f4aa89a173ecb87bad077b31 100644
|
| --- a/device/bluetooth/bluetooth_adapter_experimental_chromeos.h
|
| +++ b/device/bluetooth/bluetooth_adapter_experimental_chromeos.h
|
| @@ -8,6 +8,9 @@
|
| #include <string>
|
|
|
| #include "base/memory/weak_ptr.h"
|
| +#include "chromeos/dbus/experimental_bluetooth_adapter_client.h"
|
| +#include "chromeos/dbus/experimental_bluetooth_device_client.h"
|
| +#include "dbus/object_path.h"
|
| #include "device/bluetooth/bluetooth_adapter.h"
|
|
|
| namespace device {
|
| @@ -18,12 +21,17 @@ class BluetoothAdapterFactory;
|
|
|
| namespace chromeos {
|
|
|
| +class BluetoothDeviceExperimentalChromeOS;
|
| +class BluetoothExperimentalChromeOSTest;
|
| +
|
| // The BluetoothAdapterExperimentalChromeOS class is an alternate implementation
|
| // of BluetoothAdapter for the Chrome OS platform using the Bluetooth Smart
|
| // capable backend. It will become the sole implementation for Chrome OS, and
|
| // be renamed to BluetoothAdapterChromeOS, once the backend is switched,
|
| class BluetoothAdapterExperimentalChromeOS
|
| - : public device::BluetoothAdapter {
|
| + : public device::BluetoothAdapter,
|
| + private chromeos::ExperimentalBluetoothAdapterClient::Observer,
|
| + private chromeos::ExperimentalBluetoothDeviceClient::Observer {
|
| public:
|
| // BluetoothAdapter override
|
| virtual void AddObserver(
|
| @@ -53,10 +61,66 @@ class BluetoothAdapterExperimentalChromeOS
|
|
|
| private:
|
| friend class device::BluetoothAdapterFactory;
|
| + friend class BluetoothDeviceExperimentalChromeOS;
|
| + friend class BluetoothExperimentalChromeOSTest;
|
|
|
| BluetoothAdapterExperimentalChromeOS();
|
| virtual ~BluetoothAdapterExperimentalChromeOS();
|
|
|
| + // ExperimentalBluetoothAdapterClient::Observer override.
|
| + virtual void AdapterAdded(const dbus::ObjectPath& object_path) OVERRIDE;
|
| + virtual void AdapterRemoved(const dbus::ObjectPath& object_path) OVERRIDE;
|
| + virtual void AdapterPropertyChanged(
|
| + const dbus::ObjectPath& object_path,
|
| + const std::string& property_name) OVERRIDE;
|
| +
|
| + // ExperimentalBluetoothDeviceClient::Observer override.
|
| + virtual void DeviceAdded(const dbus::ObjectPath& object_path) OVERRIDE;
|
| + virtual void DeviceRemoved(const dbus::ObjectPath& object_path) OVERRIDE;
|
| + virtual void DevicePropertyChanged(const dbus::ObjectPath& object_path,
|
| + const std::string& property_name) OVERRIDE;
|
| +
|
| + // Internal method used to locate the device object by object path
|
| + // (the devices map and BluetoothDevice methods are by address)
|
| + BluetoothDeviceExperimentalChromeOS* GetDeviceWithPath(
|
| + 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.
|
| + void SetAdapter(const dbus::ObjectPath& object_path);
|
| +
|
| + // Remove the currently tracked adapter. IsPresent() will return false after
|
| + // this is called.
|
| + void RemoveAdapter();
|
| +
|
| + // Announce to observers a change in the adapter state.
|
| + void PoweredChanged(bool powered);
|
| + void DiscoveringChanged(bool discovering);
|
| + void PresentChanged(bool present);
|
| +
|
| + // Called by dbus:: on completion of the powered property change.
|
| + void OnSetPowered(const base::Closure& callback,
|
| + const ErrorCallback& error_callback,
|
| + bool success);
|
| +
|
| + // Called by dbus:: on completion of the D-Bus method call to start discovery.
|
| + void OnStartDiscovery(const base::Closure& callback);
|
| + void OnStartDiscoveryError(const ErrorCallback& error_callback,
|
| + const std::string& error_name,
|
| + const std::string& error_message);
|
| +
|
| + // Called by dbus:: on completion of the D-Bus method call to stop discovery.
|
| + void OnStopDiscovery(const base::Closure& callback);
|
| + void OnStopDiscoveryError(const ErrorCallback& error_callback,
|
| + const std::string& error_name,
|
| + const std::string& error_message);
|
| +
|
| + // Object path of the adapter we track.
|
| + dbus::ObjectPath object_path_;
|
| +
|
| + // List of observers interested in event notifications from us.
|
| + ObserverList<device::BluetoothAdapter::Observer> observers_;
|
| +
|
| // 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<BluetoothAdapterExperimentalChromeOS> weak_ptr_factory_;
|
|
|