| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // ID Not In Map Note: | 5 // ID Not In Map Note: |
| 6 // A service, characteristic, or descriptor ID not in the corresponding | 6 // A service, characteristic, or descriptor ID not in the corresponding |
| 7 // BluetoothDispatcherHost map [service_to_device_, characteristic_to_service_, | 7 // BluetoothDispatcherHost map [service_to_device_, characteristic_to_service_, |
| 8 // descriptor_to_characteristic_] implies a hostile renderer because a renderer | 8 // descriptor_to_characteristic_] implies a hostile renderer because a renderer |
| 9 // obtains the corresponding ID from this class and it will be added to the map | 9 // obtains the corresponding ID from this class and it will be added to the map |
| 10 // at that time. | 10 // at that time. |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 for (device::BluetoothAdapter::Observer* observer : adapter_observers_) { | 476 for (device::BluetoothAdapter::Observer* observer : adapter_observers_) { |
| 477 adapter_->RemoveObserver(observer); | 477 adapter_->RemoveObserver(observer); |
| 478 } | 478 } |
| 479 } | 479 } |
| 480 adapter_ = adapter; | 480 adapter_ = adapter; |
| 481 if (adapter_.get()) { | 481 if (adapter_.get()) { |
| 482 adapter_->AddObserver(this); | 482 adapter_->AddObserver(this); |
| 483 for (device::BluetoothAdapter::Observer* observer : adapter_observers_) { | 483 for (device::BluetoothAdapter::Observer* observer : adapter_observers_) { |
| 484 adapter_->AddObserver(observer); | 484 adapter_->AddObserver(observer); |
| 485 } | 485 } |
| 486 } else { |
| 487 // Notify that the adapter has been removed and observers should clean up |
| 488 // their state. |
| 489 for (device::BluetoothAdapter::Observer* observer : adapter_observers_) { |
| 490 observer->AdapterPresentChanged(nullptr, false); |
| 491 } |
| 486 } | 492 } |
| 487 } | 493 } |
| 488 | 494 |
| 489 void BluetoothDispatcherHost::StartDeviceDiscovery( | 495 void BluetoothDispatcherHost::StartDeviceDiscovery( |
| 490 RequestDeviceSession* session, | 496 RequestDeviceSession* session, |
| 491 int chooser_id) { | 497 int chooser_id) { |
| 492 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 498 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 493 if (session->discovery_session) { | 499 if (session->discovery_session) { |
| 494 // Already running; just increase the timeout. | 500 // Already running; just increase the timeout. |
| 495 discovery_session_timer_.Reset(); | 501 discovery_session_timer_.Reset(); |
| (...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1412 const PrimaryServicesRequest& request) { | 1418 const PrimaryServicesRequest& request) { |
| 1413 pending_primary_services_requests_[device_address].push_back(request); | 1419 pending_primary_services_requests_[device_address].push_back(request); |
| 1414 } | 1420 } |
| 1415 | 1421 |
| 1416 url::Origin BluetoothDispatcherHost::GetOrigin(int frame_routing_id) { | 1422 url::Origin BluetoothDispatcherHost::GetOrigin(int frame_routing_id) { |
| 1417 return RenderFrameHostImpl::FromID(render_process_id_, frame_routing_id) | 1423 return RenderFrameHostImpl::FromID(render_process_id_, frame_routing_id) |
| 1418 ->GetLastCommittedOrigin(); | 1424 ->GetLastCommittedOrigin(); |
| 1419 } | 1425 } |
| 1420 | 1426 |
| 1421 } // namespace content | 1427 } // namespace content |
| OLD | NEW |