Chromium Code Reviews| Index: device/bluetooth/bluetooth_adapter_android.h |
| diff --git a/device/bluetooth/bluetooth_adapter_mac.h b/device/bluetooth/bluetooth_adapter_android.h |
| similarity index 54% |
| copy from device/bluetooth/bluetooth_adapter_mac.h |
| copy to device/bluetooth/bluetooth_adapter_android.h |
| index 08c4fb5e7786cb5671782ed04555aa09316ce01e..cbfe5d31ab14719da452cd7e262ce4c8c8476766 100644 |
| --- a/device/bluetooth/bluetooth_adapter_mac.h |
| +++ b/device/bluetooth/bluetooth_adapter_android.h |
| @@ -1,42 +1,23 @@ |
| -// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| // 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_MAC_H_ |
| -#define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ |
| +#ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_ANDROID_H_ |
| +#define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_ANDROID_H_ |
| -#include <IOKit/IOReturn.h> |
| - |
| -#include <string> |
| -#include <vector> |
| - |
| -#include "base/containers/hash_tables.h" |
| -#include "base/mac/scoped_nsobject.h" |
| -#include "base/memory/ref_counted.h" |
| #include "base/memory/weak_ptr.h" |
| -#include "base/observer_list.h" |
| #include "device/bluetooth/bluetooth_adapter.h" |
| -#include "device/bluetooth/bluetooth_audio_sink.h" |
| -#include "device/bluetooth/bluetooth_discovery_manager_mac.h" |
| -#include "device/bluetooth/bluetooth_export.h" |
| - |
| -@class IOBluetoothDevice; |
| -@class NSArray; |
| -@class NSDate; |
| namespace base { |
| - |
| class SequencedTaskRunner; |
| - |
| } // namespace base |
| namespace device { |
| -class BluetoothAdapterMacTest; |
| - |
| -class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterMac |
| - : public BluetoothAdapter, |
| - public BluetoothDiscoveryManagerMac::Observer { |
| +// The BluetoothAdapterAndroid class implements BluetoothAdapter for the |
| +// Android platform. |
| +class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterAndroid final |
| + : public BluetoothAdapter { |
| public: |
| static base::WeakPtr<BluetoothAdapter> CreateAdapter(); |
| @@ -69,30 +50,16 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterMac |
| const CreateServiceErrorCallback& error_callback) override; |
| void RegisterAudioSink( |
| const BluetoothAudioSink::Options& options, |
| - const AcquiredCallback& callback, |
| + const BluetoothAdapter::AcquiredCallback& callback, |
|
armansito
2015/04/29 01:17:28
The BluetoothAdapter:: part shouldn't be necessary
scheib
2015/04/29 01:35:14
Done.
|
| const BluetoothAudioSink::ErrorCallback& error_callback) override; |
| void RegisterAdvertisement( |
| scoped_ptr<BluetoothAdvertisement::Data> advertisement_data, |
| const CreateAdvertisementCallback& callback, |
| const CreateAdvertisementErrorCallback& error_callback) override; |
| - // BluetoothDiscoveryManagerMac::Observer overrides |
| - void DeviceFound(IOBluetoothDevice* device) override; |
| - void DiscoveryStopped(bool unexpected) override; |
| - |
| - // Registers that a new |device| has connected to the local host. |
| - void DeviceConnected(IOBluetoothDevice* device); |
| - |
| protected: |
| - // BluetoothAdapter: |
| - void RemovePairingDelegateInternal( |
| - device::BluetoothDevice::PairingDelegate* pairing_delegate) override; |
| - |
| - private: |
| - friend class BluetoothAdapterMacTest; |
| - |
| - BluetoothAdapterMac(); |
| - ~BluetoothAdapterMac() override; |
| + BluetoothAdapterAndroid(); |
| + ~BluetoothAdapterAndroid() override; |
| // BluetoothAdapter: |
| void AddDiscoverySession(BluetoothDiscoveryFilter* discovery_filter, |
| @@ -104,36 +71,19 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterMac |
| void SetDiscoveryFilter(scoped_ptr<BluetoothDiscoveryFilter> discovery_filter, |
| const base::Closure& callback, |
| const ErrorCallback& error_callback) override; |
| - |
| - void Init(); |
| - void InitForTest(scoped_refptr<base::SequencedTaskRunner> ui_task_runner); |
| - void PollAdapter(); |
| - |
| - // Registers that a new |device| has replied to an Inquiry, is paired, or has |
| - // connected to the local host. |
| - void DeviceAdded(IOBluetoothDevice* device); |
| - |
| - // Updates |devices_| to include the currently paired devices, as well as any |
| - // connected, but unpaired, devices. Notifies observers if any previously |
| - // paired or connected devices are no longer present. |
| - void UpdateDevices(); |
| + void RemovePairingDelegateInternal( |
| + BluetoothDevice::PairingDelegate* pairing_delegate) override; |
| std::string address_; |
| std::string name_; |
| - bool powered_; |
| - |
| - int num_discovery_sessions_; |
| - |
| - // Discovery manager for Bluetooth Classic. |
| - scoped_ptr<BluetoothDiscoveryManagerMac> classic_discovery_manager_; |
| - |
| - scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
| - base::WeakPtrFactory<BluetoothAdapterMac> weak_ptr_factory_; |
| + // 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<BluetoothAdapterAndroid> weak_ptr_factory_; |
| - DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterMac); |
| + DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterAndroid); |
| }; |
| } // namespace device |
| -#endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_MAC_H_ |
| +#endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_ANDROID_H_ |