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

Side by Side Diff: device/bluetooth/bluetooth_adapter_win.h

Issue 11345037: Implemented BluetoothAdapterWin::IsPresent(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Made adapter refcounted in unittest Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 BluetoothAdapterWinTest;
bryeung 2012/11/12 20:35:13 I don't think you need these if you're just making
youngki 2012/11/13 01:57:39 The compiler is throwing errors without this, so I
16 class BluetoothDevice; 17 class BluetoothDevice;
17 18
18 class BluetoothAdapterWin : public BluetoothAdapter { 19 class BluetoothAdapterWin : public BluetoothAdapter {
20 public:
19 // BluetoothAdapter override 21 // BluetoothAdapter override
20 virtual void AddObserver(BluetoothAdapter::Observer* observer) OVERRIDE; 22 virtual void AddObserver(BluetoothAdapter::Observer* observer) OVERRIDE;
21 virtual void RemoveObserver(BluetoothAdapter::Observer* observer) OVERRIDE; 23 virtual void RemoveObserver(BluetoothAdapter::Observer* observer) OVERRIDE;
22 virtual bool IsPresent() const OVERRIDE; 24 virtual bool IsPresent() const OVERRIDE;
23 virtual bool IsPowered() const OVERRIDE; 25 virtual bool IsPowered() const OVERRIDE;
24 virtual void SetPowered( 26 virtual void SetPowered(
25 bool powered, 27 bool powered,
26 const base::Closure& callback, 28 const base::Closure& callback,
27 const ErrorCallback& error_callback) OVERRIDE; 29 const ErrorCallback& error_callback) OVERRIDE;
28 virtual bool IsDiscovering() const OVERRIDE; 30 virtual bool IsDiscovering() const OVERRIDE;
29 virtual void SetDiscovering( 31 virtual void SetDiscovering(
30 bool discovering, 32 bool discovering,
31 const base::Closure& callback, 33 const base::Closure& callback,
32 const ErrorCallback& error_callback) OVERRIDE; 34 const ErrorCallback& error_callback) OVERRIDE;
33 virtual ConstDeviceList GetDevices() const OVERRIDE; 35 virtual ConstDeviceList GetDevices() const OVERRIDE;
34 virtual BluetoothDevice* GetDevice(const std::string& address) OVERRIDE; 36 virtual BluetoothDevice* GetDevice(const std::string& address) OVERRIDE;
35 virtual const BluetoothDevice* GetDevice( 37 virtual const BluetoothDevice* GetDevice(
36 const std::string& address) const OVERRIDE; 38 const std::string& address) const OVERRIDE;
37 virtual void ReadLocalOutOfBandPairingData( 39 virtual void ReadLocalOutOfBandPairingData(
38 const BluetoothOutOfBandPairingDataCallback& callback, 40 const BluetoothOutOfBandPairingDataCallback& callback,
39 const ErrorCallback& error_callback) OVERRIDE; 41 const ErrorCallback& error_callback) OVERRIDE;
40 42
41 private: 43 protected:
42 friend class device::BluetoothAdapterFactory;
43
44 BluetoothAdapterWin(); 44 BluetoothAdapterWin();
45 virtual ~BluetoothAdapterWin(); 45 virtual ~BluetoothAdapterWin();
46 46
47 virtual void UpdateAdapterState();
48
49 private:
50 friend class device::BluetoothAdapterFactory;
51 friend class device::BluetoothAdapterWinTest;
bryeung 2012/11/12 20:35:13 s/device:://
youngki 2012/11/13 01:57:39 Done.
52
53 // Obtains the default adapter info (the first bluetooth radio info) and
bryeung 2012/11/12 20:35:13 This comment isn't very clear to me: are you tryin
youngki 2012/11/13 01:57:39 yes. I updated the comment.
54 // tracks future changes to it.
55 void TrackDefaultAdapter();
56
57 void PollAdapterState();
58
59 static const int kPollIntervalMs;
60
47 // NOTE: This should remain the last member so it'll be destroyed and 61 // NOTE: This should remain the last member so it'll be destroyed and
48 // invalidate its weak pointers before any other members are destroyed. 62 // invalidate its weak pointers before any other members are destroyed.
49 base::WeakPtrFactory<BluetoothAdapterWin> weak_ptr_factory_; 63 base::WeakPtrFactory<BluetoothAdapterWin> weak_ptr_factory_;
50 64
51 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterWin); 65 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterWin);
52 }; 66 };
53 67
54 } // namespace device 68 } // namespace device
55 69
56 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_WIN_H_ 70 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_WIN_H_
OLDNEW
« no previous file with comments | « no previous file | device/bluetooth/bluetooth_adapter_win.cc » ('j') | device/bluetooth/bluetooth_adapter_win_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698