OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 // WebBluetoothServiceImpl map [service_id_to_device_address_, | 7 // WebBluetoothServiceImpl map [service_id_to_device_address_, |
8 // characteristic_id_to_service_id_, descriptor_to_characteristic_] implies a | 8 // characteristic_id_to_service_id_, descriptor_to_characteristic_] implies a |
9 // hostile renderer because a renderer obtains the corresponding ID from this | 9 // hostile renderer because a renderer obtains the corresponding ID from this |
10 // class and it will be added to the map at that time. | 10 // class and it will be added to the map at that time. |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 blink::mojom::WebBluetoothRequestDeviceOptionsPtr options, | 678 blink::mojom::WebBluetoothRequestDeviceOptionsPtr options, |
679 const RequestDeviceCallback& callback, | 679 const RequestDeviceCallback& callback, |
680 device::BluetoothAdapter* adapter) { | 680 device::BluetoothAdapter* adapter) { |
681 // requestDevice() can only be called when processing a user-gesture and any | 681 // requestDevice() can only be called when processing a user-gesture and any |
682 // user gesture outside of a chooser should close the chooser. This does | 682 // user gesture outside of a chooser should close the chooser. This does |
683 // not happen on all platforms so we don't DCHECK that the old one is closed. | 683 // not happen on all platforms so we don't DCHECK that the old one is closed. |
684 // We destroy the old chooser before constructing the new one to make sure | 684 // We destroy the old chooser before constructing the new one to make sure |
685 // they can't conflict. | 685 // they can't conflict. |
686 device_chooser_controller_.reset(); | 686 device_chooser_controller_.reset(); |
687 | 687 |
688 device_chooser_controller_.reset( | 688 device_chooser_controller_.reset(new BluetoothDeviceChooserController( |
689 new BluetoothDeviceChooserController(this, render_frame_host_, adapter)); | 689 this, render_frame_host_, adapter, &allowed_devices_map_, GetOrigin())); |
690 | 690 |
691 device_chooser_controller_->GetDevice( | 691 device_chooser_controller_->GetDevice( |
692 std::move(options), | 692 std::move(options), |
693 base::Bind(&WebBluetoothServiceImpl::OnGetDeviceSuccess, | 693 base::Bind(&WebBluetoothServiceImpl::OnGetDeviceSuccess, |
694 weak_ptr_factory_.GetWeakPtr(), callback), | 694 weak_ptr_factory_.GetWeakPtr(), callback), |
695 base::Bind(&WebBluetoothServiceImpl::OnGetDeviceFailed, | 695 base::Bind(&WebBluetoothServiceImpl::OnGetDeviceFailed, |
696 weak_ptr_factory_.GetWeakPtr(), callback)); | 696 weak_ptr_factory_.GetWeakPtr(), callback)); |
697 } | 697 } |
698 | 698 |
699 void WebBluetoothServiceImpl::RemoteServerGetPrimaryServicesImpl( | 699 void WebBluetoothServiceImpl::RemoteServerGetPrimaryServicesImpl( |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 characteristic_id_to_service_id_.clear(); | 995 characteristic_id_to_service_id_.clear(); |
996 service_id_to_device_address_.clear(); | 996 service_id_to_device_address_.clear(); |
997 connected_devices_.reset( | 997 connected_devices_.reset( |
998 new FrameConnectedBluetoothDevices(render_frame_host_)); | 998 new FrameConnectedBluetoothDevices(render_frame_host_)); |
999 allowed_devices_map_ = BluetoothAllowedDevicesMap(); | 999 allowed_devices_map_ = BluetoothAllowedDevicesMap(); |
1000 device_chooser_controller_.reset(); | 1000 device_chooser_controller_.reset(); |
1001 BluetoothAdapterFactoryWrapper::Get().ReleaseAdapter(this); | 1001 BluetoothAdapterFactoryWrapper::Get().ReleaseAdapter(this); |
1002 } | 1002 } |
1003 | 1003 |
1004 } // namespace content | 1004 } // namespace content |
OLD | NEW |