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