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 #include "device/bluetooth/bluetooth_adapter_win.h" | 5 #include "device/bluetooth/bluetooth_adapter_win.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/sequenced_task_runner.h" | 13 #include "base/sequenced_task_runner.h" |
14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
16 #include "base/threading/thread_task_runner_handle.h" | 16 #include "base/threading/thread_task_runner_handle.h" |
17 #include "device/bluetooth/bluetooth_device_win.h" | 17 #include "device/bluetooth/bluetooth_device_win.h" |
18 #include "device/bluetooth/bluetooth_discovery_session_outcome.h" | 18 #include "device/bluetooth/bluetooth_discovery_session_outcome.h" |
19 #include "device/bluetooth/bluetooth_socket_thread.h" | 19 #include "device/bluetooth/bluetooth_socket_thread.h" |
20 #include "device/bluetooth/bluetooth_socket_win.h" | 20 #include "device/bluetooth/bluetooth_socket_win.h" |
21 #include "device/bluetooth/bluetooth_task_manager_win.h" | 21 #include "device/bluetooth/bluetooth_task_manager_win.h" |
22 #include "device/bluetooth/bluetooth_uuid.h" | 22 #include "device/bluetooth/bluetooth_uuid.h" |
| 23 #include "net/log/net_log_source.h" |
23 | 24 |
24 namespace device { | 25 namespace device { |
25 | 26 |
26 // static | 27 // static |
27 base::WeakPtr<BluetoothAdapter> BluetoothAdapter::CreateAdapter( | 28 base::WeakPtr<BluetoothAdapter> BluetoothAdapter::CreateAdapter( |
28 const InitCallback& init_callback) { | 29 const InitCallback& init_callback) { |
29 return BluetoothAdapterWin::CreateAdapter(init_callback); | 30 return BluetoothAdapterWin::CreateAdapter(init_callback); |
30 } | 31 } |
31 | 32 |
32 // static | 33 // static |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 DeviceAddressSet changed_devices = | 276 DeviceAddressSet changed_devices = |
276 base::STLSetIntersection<DeviceAddressSet>(known_devices, new_devices); | 277 base::STLSetIntersection<DeviceAddressSet>(known_devices, new_devices); |
277 for (ScopedVector<BluetoothTaskManagerWin::DeviceState>::const_iterator iter = | 278 for (ScopedVector<BluetoothTaskManagerWin::DeviceState>::const_iterator iter = |
278 devices.begin(); | 279 devices.begin(); |
279 iter != devices.end(); | 280 iter != devices.end(); |
280 ++iter) { | 281 ++iter) { |
281 BluetoothTaskManagerWin::DeviceState* device_state = (*iter); | 282 BluetoothTaskManagerWin::DeviceState* device_state = (*iter); |
282 if (added_devices.find(device_state->address) != added_devices.end()) { | 283 if (added_devices.find(device_state->address) != added_devices.end()) { |
283 BluetoothDeviceWin* device_win = | 284 BluetoothDeviceWin* device_win = |
284 new BluetoothDeviceWin(this, *device_state, ui_task_runner_, | 285 new BluetoothDeviceWin(this, *device_state, ui_task_runner_, |
285 socket_thread_, NULL, net::NetLog::Source()); | 286 socket_thread_, NULL, net::NetLogSource()); |
286 devices_.set(device_state->address, | 287 devices_.set(device_state->address, |
287 std::unique_ptr<BluetoothDevice>(device_win)); | 288 std::unique_ptr<BluetoothDevice>(device_win)); |
288 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, | 289 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, |
289 observers_, | 290 observers_, |
290 DeviceAdded(this, device_win)); | 291 DeviceAdded(this, device_win)); |
291 } else if (changed_devices.find(device_state->address) != | 292 } else if (changed_devices.find(device_state->address) != |
292 changed_devices.end()) { | 293 changed_devices.end()) { |
293 DevicesMap::const_iterator iter = devices_.find(device_state->address); | 294 DevicesMap::const_iterator iter = devices_.find(device_state->address); |
294 DCHECK(iter != devices_.end()); | 295 DCHECK(iter != devices_.end()); |
295 BluetoothDeviceWin* device_win = | 296 BluetoothDeviceWin* device_win = |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 num_discovery_listeners_ -= on_stop_discovery_callbacks_.size(); | 389 num_discovery_listeners_ -= on_stop_discovery_callbacks_.size(); |
389 on_stop_discovery_callbacks_.clear(); | 390 on_stop_discovery_callbacks_.clear(); |
390 return; | 391 return; |
391 } | 392 } |
392 | 393 |
393 discovery_status_ = DISCOVERY_STOPPING; | 394 discovery_status_ = DISCOVERY_STOPPING; |
394 task_manager_->PostStopDiscoveryTask(); | 395 task_manager_->PostStopDiscoveryTask(); |
395 } | 396 } |
396 | 397 |
397 } // namespace device | 398 } // namespace device |
OLD | NEW |