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 <hash_set> | 7 #include <hash_set> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 void BluetoothAdapterWin::RemovePairingDelegateInternal( | 189 void BluetoothAdapterWin::RemovePairingDelegateInternal( |
190 BluetoothDevice::PairingDelegate* pairing_delegate) { | 190 BluetoothDevice::PairingDelegate* pairing_delegate) { |
191 } | 191 } |
192 | 192 |
193 void BluetoothAdapterWin::AdapterStateChanged( | 193 void BluetoothAdapterWin::AdapterStateChanged( |
194 const BluetoothTaskManagerWin::AdapterState& state) { | 194 const BluetoothTaskManagerWin::AdapterState& state) { |
195 DCHECK(thread_checker_.CalledOnValidThread()); | 195 DCHECK(thread_checker_.CalledOnValidThread()); |
196 name_ = state.name; | 196 name_ = state.name; |
197 bool was_present = IsPresent(); | 197 bool was_present = IsPresent(); |
198 bool is_present = !state.address.empty(); | 198 bool is_present = !state.address.empty(); |
199 address_ = state.address; | 199 address_ = BluetoothDevice::CanonicalizeAddress(state.address); |
200 if (was_present != is_present) { | 200 if (was_present != is_present) { |
201 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, | 201 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, |
202 AdapterPresentChanged(this, is_present)); | 202 AdapterPresentChanged(this, is_present)); |
203 } | 203 } |
204 if (powered_ != state.powered) { | 204 if (powered_ != state.powered) { |
205 powered_ = state.powered; | 205 powered_ = state.powered; |
206 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, | 206 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, |
207 AdapterPoweredChanged(this, powered_)); | 207 AdapterPoweredChanged(this, powered_)); |
208 } | 208 } |
209 if (!initialized_) { | 209 if (!initialized_) { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 num_discovery_listeners_ -= on_stop_discovery_callbacks_.size(); | 309 num_discovery_listeners_ -= on_stop_discovery_callbacks_.size(); |
310 on_stop_discovery_callbacks_.clear(); | 310 on_stop_discovery_callbacks_.clear(); |
311 return; | 311 return; |
312 } | 312 } |
313 | 313 |
314 discovery_status_ = DISCOVERY_STOPPING; | 314 discovery_status_ = DISCOVERY_STOPPING; |
315 task_manager_->PostStopDiscoveryTask(); | 315 task_manager_->PostStopDiscoveryTask(); |
316 } | 316 } |
317 | 317 |
318 } // namespace device | 318 } // namespace device |
OLD | NEW |