Chromium Code Reviews| Index: content/browser/bluetooth/bluetooth_dispatcher_host.cc |
| diff --git a/content/browser/bluetooth/bluetooth_dispatcher_host.cc b/content/browser/bluetooth/bluetooth_dispatcher_host.cc |
| index b69fa4fa49f19a3632cda132998f947eec1a764d..e8c3bd8a4ce8a7b295717eda25f058d55fde2007 100644 |
| --- a/content/browser/bluetooth/bluetooth_dispatcher_host.cc |
| +++ b/content/browser/bluetooth/bluetooth_dispatcher_host.cc |
| @@ -696,8 +696,8 @@ void BluetoothDispatcherHost::OnGATTServerConnect( |
| query_result.device->CreateGattConnection( |
| base::Bind(&BluetoothDispatcherHost::OnGATTConnectionCreated, |
| - weak_ptr_on_ui_thread_, thread_id, request_id, device_id, |
| - start_time), |
| + weak_ptr_on_ui_thread_, thread_id, request_id, |
| + frame_routing_id, device_id, start_time), |
| base::Bind(&BluetoothDispatcherHost::OnCreateGATTConnectionError, |
| weak_ptr_on_ui_thread_, thread_id, request_id, device_id, |
| start_time)); |
| @@ -722,6 +722,14 @@ void BluetoothDispatcherHost::OnGATTServerDisconnect( |
| return; |
| } |
| + RenderFrameHostImpl* render_frame_host = |
| + RenderFrameHostImpl::FromID(render_process_id_, frame_routing_id); |
| + WebContents* web_contents = |
| + WebContents::FromRenderFrameHost(render_frame_host); |
| + if (render_frame_host && web_contents) { |
|
miu
2016/03/04 23:42:37
nit: Not necessary to test render_frame_host, sinc
ortuno
2016/03/14 20:52:50
Done.
|
| + web_contents->SetBluetoothDeviceConnected(false); |
| + } |
| + |
| // The last BluetoothGattConnection for a device closes the connection when |
| // it's destroyed. |
| if (device_id_to_connection_map_.erase(device_id)) { |
| @@ -1440,6 +1448,7 @@ void BluetoothDispatcherHost::FinishClosingChooser( |
| void BluetoothDispatcherHost::OnGATTConnectionCreated( |
| int thread_id, |
| int request_id, |
| + int frame_routing_id, |
| const std::string& device_id, |
| base::TimeTicks start_time, |
| scoped_ptr<device::BluetoothGattConnection> connection) { |
| @@ -1447,6 +1456,13 @@ void BluetoothDispatcherHost::OnGATTConnectionCreated( |
| device_id_to_connection_map_[device_id] = std::move(connection); |
| RecordConnectGATTTimeSuccess(base::TimeTicks::Now() - start_time); |
| RecordConnectGATTOutcome(UMAConnectGATTOutcome::SUCCESS); |
| + RenderFrameHostImpl* render_frame_host = |
| + RenderFrameHostImpl::FromID(render_process_id_, frame_routing_id); |
| + WebContents* web_contents = |
| + WebContents::FromRenderFrameHost(render_frame_host); |
| + if (render_frame_host && web_contents) { |
|
miu
2016/03/04 23:42:37
nit: ditto--no need for render_frame_host
ortuno
2016/03/14 20:52:50
Done.
|
| + web_contents->SetBluetoothDeviceConnected(true); |
| + } |
| Send(new BluetoothMsg_GATTServerConnectSuccess(thread_id, request_id)); |
| } |