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 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
17 #include "device/bluetooth/bluetooth_adapter.h" | 17 #include "device/bluetooth/bluetooth_adapter.h" |
18 #include "device/bluetooth/bluetooth_task_manager_win.h" | 18 #include "device/bluetooth/bluetooth_task_manager_win.h" |
19 | 19 |
20 namespace base { | 20 namespace base { |
21 | |
22 class SequencedTaskRunner; | 21 class SequencedTaskRunner; |
23 | 22 class Thread; |
24 } // namespace base | 23 } // namespace base |
25 | 24 |
26 namespace device { | 25 namespace device { |
27 | 26 |
28 class BluetoothAdapterFactory; | 27 class BluetoothAdapterFactory; |
29 class BluetoothAdapterWinTest; | 28 class BluetoothAdapterWinTest; |
30 class BluetoothDevice; | 29 class BluetoothDevice; |
| 30 class BluetoothSocketThreadWin; |
31 | 31 |
32 class BluetoothAdapterWin : public BluetoothAdapter, | 32 class BluetoothAdapterWin : public BluetoothAdapter, |
33 public BluetoothTaskManagerWin::Observer { | 33 public BluetoothTaskManagerWin::Observer { |
34 public: | 34 public: |
35 typedef base::Callback<void()> InitCallback; | 35 typedef base::Callback<void()> InitCallback; |
36 | 36 |
37 // BluetoothAdapter override | 37 // BluetoothAdapter override |
38 virtual void AddObserver(BluetoothAdapter::Observer* observer) OVERRIDE; | 38 virtual void AddObserver(BluetoothAdapter::Observer* observer) OVERRIDE; |
39 virtual void RemoveObserver(BluetoothAdapter::Observer* observer) OVERRIDE; | 39 virtual void RemoveObserver(BluetoothAdapter::Observer* observer) OVERRIDE; |
40 virtual std::string GetAddress() const OVERRIDE; | 40 virtual std::string GetAddress() const OVERRIDE; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 bool powered_; | 114 bool powered_; |
115 DiscoveryStatus discovery_status_; | 115 DiscoveryStatus discovery_status_; |
116 base::hash_set<std::string> discovered_devices_; | 116 base::hash_set<std::string> discovered_devices_; |
117 | 117 |
118 std::vector<std::pair<base::Closure, ErrorCallback> > | 118 std::vector<std::pair<base::Closure, ErrorCallback> > |
119 on_start_discovery_callbacks_; | 119 on_start_discovery_callbacks_; |
120 std::vector<base::Closure> on_stop_discovery_callbacks_; | 120 std::vector<base::Closure> on_stop_discovery_callbacks_; |
121 size_t num_discovery_listeners_; | 121 size_t num_discovery_listeners_; |
122 | 122 |
123 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; | 123 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
| 124 scoped_refptr<BluetoothSocketThreadWin> socket_thread_; |
124 scoped_refptr<BluetoothTaskManagerWin> task_manager_; | 125 scoped_refptr<BluetoothTaskManagerWin> task_manager_; |
125 | 126 |
126 base::ThreadChecker thread_checker_; | 127 base::ThreadChecker thread_checker_; |
127 | 128 |
128 // List of observers interested in event notifications from us. | 129 // List of observers interested in event notifications from us. |
129 ObserverList<BluetoothAdapter::Observer> observers_; | 130 ObserverList<BluetoothAdapter::Observer> observers_; |
130 | 131 |
131 // NOTE: This should remain the last member so it'll be destroyed and | 132 // NOTE: This should remain the last member so it'll be destroyed and |
132 // invalidate its weak pointers before any other members are destroyed. | 133 // invalidate its weak pointers before any other members are destroyed. |
133 base::WeakPtrFactory<BluetoothAdapterWin> weak_ptr_factory_; | 134 base::WeakPtrFactory<BluetoothAdapterWin> weak_ptr_factory_; |
134 | 135 |
135 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterWin); | 136 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterWin); |
136 }; | 137 }; |
137 | 138 |
138 } // namespace device | 139 } // namespace device |
139 | 140 |
140 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_WIN_H_ | 141 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_WIN_H_ |
OLD | NEW |