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

Side by Side Diff: content/browser/bluetooth/bluetooth_dispatcher_host.cc

Issue 1898303003: bluetooth: Clean up WebBluetoothServiceImpl when adapter is removed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Clean up Created 4 years, 8 months 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
« no previous file with comments | « no previous file | content/browser/bluetooth/web_bluetooth_service_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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);
Jeffrey Yasskin 2016/04/19 21:08:27 To be strictly correct, this should probably pass
ortuno 2016/04/19 21:36:32 In practice there will never be more than one adap
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
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
OLDNEW
« no previous file with comments | « no previous file | content/browser/bluetooth/web_bluetooth_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698