Chromium Code Reviews| 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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 643 } | 643 } |
| 644 notify_session_iter->second->Stop(base::Bind( | 644 notify_session_iter->second->Stop(base::Bind( |
| 645 &WebBluetoothServiceImpl::OnStopNotifySessionComplete, | 645 &WebBluetoothServiceImpl::OnStopNotifySessionComplete, |
| 646 weak_ptr_factory_.GetWeakPtr(), characteristic_instance_id, callback)); | 646 weak_ptr_factory_.GetWeakPtr(), characteristic_instance_id, callback)); |
| 647 } | 647 } |
| 648 | 648 |
| 649 void WebBluetoothServiceImpl::RequestDeviceImpl( | 649 void WebBluetoothServiceImpl::RequestDeviceImpl( |
| 650 blink::mojom::WebBluetoothRequestDeviceOptionsPtr options, | 650 blink::mojom::WebBluetoothRequestDeviceOptionsPtr options, |
| 651 const RequestDeviceCallback& callback, | 651 const RequestDeviceCallback& callback, |
| 652 device::BluetoothAdapter* adapter) { | 652 device::BluetoothAdapter* adapter) { |
| 653 // requestDevice() can only be called when processing a user-gesture and | 653 // requestDevice() can only be called when processing a user-gesture and any |
| 654 // any user gesture outside of a chooser should close the chooser so we should | 654 // user gesture outside of a chooser should close the chooser. But this does |
| 655 // never get a request with an open chooser. | 655 // not happen on all platforms so we manually close any open choosers. |
| 656 CHECK(!device_chooser_controller_.get()); | 656 device_chooser_controller_.reset(); |
|
Jeffrey Yasskin
2016/06/10 00:49:22
Can you just delete this line? That'll wind up des
ortuno
2016/06/10 18:10:07
I revised the comment. Let me know if you don't th
Jeffrey Yasskin
2016/06/10 18:47:18
Well, the second chooser doesn't open until you ca
ortuno
2016/06/10 19:32:01
Done. Thanks for the suggestion!
| |
| 657 | 657 |
| 658 device_chooser_controller_.reset(new BluetoothDeviceChooserController( | 658 device_chooser_controller_.reset(new BluetoothDeviceChooserController( |
| 659 this, render_frame_host_, adapter, | 659 this, render_frame_host_, adapter, |
| 660 GetBluetoothAdapterFactoryWrapper()->GetScanDuration())); | 660 GetBluetoothAdapterFactoryWrapper()->GetScanDuration())); |
| 661 | 661 |
| 662 device_chooser_controller_->GetDevice( | 662 device_chooser_controller_->GetDevice( |
| 663 std::move(options), | 663 std::move(options), |
| 664 base::Bind(&WebBluetoothServiceImpl::OnGetDeviceSuccess, | 664 base::Bind(&WebBluetoothServiceImpl::OnGetDeviceSuccess, |
| 665 weak_ptr_factory_.GetWeakPtr(), callback), | 665 weak_ptr_factory_.GetWeakPtr(), callback), |
| 666 base::Bind(&WebBluetoothServiceImpl::OnGetDeviceFailed, | 666 base::Bind(&WebBluetoothServiceImpl::OnGetDeviceFailed, |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 953 characteristic_id_to_service_id_.clear(); | 953 characteristic_id_to_service_id_.clear(); |
| 954 service_id_to_device_address_.clear(); | 954 service_id_to_device_address_.clear(); |
| 955 connected_devices_.reset( | 955 connected_devices_.reset( |
| 956 new FrameConnectedBluetoothDevices(render_frame_host_)); | 956 new FrameConnectedBluetoothDevices(render_frame_host_)); |
| 957 allowed_devices_map_ = BluetoothAllowedDevicesMap(); | 957 allowed_devices_map_ = BluetoothAllowedDevicesMap(); |
| 958 device_chooser_controller_.reset(); | 958 device_chooser_controller_.reset(); |
| 959 GetBluetoothAdapterFactoryWrapper()->ReleaseAdapter(this); | 959 GetBluetoothAdapterFactoryWrapper()->ReleaseAdapter(this); |
| 960 } | 960 } |
| 961 | 961 |
| 962 } // namespace content | 962 } // namespace content |
| OLD | NEW |