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 fe6fc27aaa51e0b59d5cc0e3f5e770d60043943a..0752c7cce2f1888426436f5d3b877c4e46f277e6 100644 |
| --- a/content/browser/bluetooth/bluetooth_dispatcher_host.cc |
| +++ b/content/browser/bluetooth/bluetooth_dispatcher_host.cc |
| @@ -724,18 +724,19 @@ 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 (web_contents) { |
| - 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)) { |
| VLOG(1) << "Disconnecting device: " << device_id; |
| + |
| + // Indicate there is one less connected device. |
| + RenderFrameHostImpl* render_frame_host = |
| + RenderFrameHostImpl::FromID(render_process_id_, frame_routing_id); |
| + WebContents* web_contents = |
| + WebContents::FromRenderFrameHost(render_frame_host); |
| + if (web_contents) { |
| + web_contents->DecrementBluetoothConnectedDeviceCount(); |
|
Jeffrey Yasskin
2016/03/31 18:00:25
Are we guaranteed that if a process crashes, it'll
ortuno
2016/04/04 21:20:56
From some experimentation it seems that if the Ren
|
| + } |
| } |
| } |
| @@ -1461,7 +1462,7 @@ void BluetoothDispatcherHost::OnGATTConnectionCreated( |
| WebContents* web_contents = |
| WebContents::FromRenderFrameHost(render_frame_host); |
| if (web_contents) { |
| - web_contents->SetBluetoothDeviceConnected(true); |
| + web_contents->IncrementBluetoothConnectedDeviceCount(); |
| } |
| Send(new BluetoothMsg_GATTServerConnectSuccess(thread_id, request_id)); |
| } |