Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame^] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_WIN_H_ |
| 6 | #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_WIN_H_ |
| 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | #include "base/memory/weak_ptr.h" |
| 11 | #include "device/bluetooth/bluetooth_adapter.h" |
| 12 | |
| 13 | namespace device { |
| 14 | |
| 15 | class BluetoothAdapterFactory; |
| 16 | class BluetoothDevice; |
| 17 | |
| 18 | class BluetoothAdapterWin : public BluetoothAdapter { |
| 19 | // BluetoothAdapter override |
| 20 | virtual void AddObserver(BluetoothAdapter::Observer* observer) OVERRIDE; |
| 21 | virtual void RemoveObserver(BluetoothAdapter::Observer* observer) OVERRIDE; |
| 22 | virtual bool IsPresent() const OVERRIDE; |
| 23 | virtual bool IsPowered() const OVERRIDE; |
| 24 | virtual void SetPowered( |
| 25 | bool powered, |
| 26 | const base::Closure& callback, |
| 27 | const ErrorCallback& error_callback) OVERRIDE; |
| 28 | virtual bool IsDiscovering() const OVERRIDE; |
| 29 | virtual void SetDiscovering( |
| 30 | bool discovering, |
| 31 | const base::Closure& callback, |
| 32 | const ErrorCallback& error_callback) OVERRIDE; |
| 33 | virtual ConstDeviceList GetDevices() const OVERRIDE; |
| 34 | virtual BluetoothDevice* GetDevice(const std::string& address) OVERRIDE; |
| 35 | virtual const BluetoothDevice* GetDevice( |
| 36 | const std::string& address) const OVERRIDE; |
| 37 | virtual void ReadLocalOutOfBandPairingData( |
| 38 | const BluetoothOutOfBandPairingDataCallback& callback, |
| 39 | const ErrorCallback& error_callback) OVERRIDE; |
| 40 | |
| 41 | private: |
| 42 | friend class device::BluetoothAdapterFactory; |
| 43 | |
| 44 | BluetoothAdapterWin(); |
| 45 | virtual ~BluetoothAdapterWin(); |
| 46 | |
| 47 | // NOTE: This should remain the last member so it'll be destroyed and |
| 48 | // invalidate its weak pointers before any other members are destroyed. |
| 49 | base::WeakPtrFactory<BluetoothAdapterWin> weak_ptr_factory_; |
| 50 | |
| 51 | DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterWin); |
| 52 | }; |
| 53 | |
| 54 | } // namespace device |
| 55 | |
| 56 | #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_WIN_H_ |