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..b23cdf1bca8344dcdf972eb566495677561114ae 100644 |
| --- a/content/browser/bluetooth/bluetooth_dispatcher_host.cc |
| +++ b/content/browser/bluetooth/bluetooth_dispatcher_host.cc |
| @@ -724,18 +724,24 @@ 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; |
| + |
| + if (!device_id_to_connection_map_.empty()) { |
|
Jeffrey Yasskin
2016/03/31 16:18:43
Currently, this is going to keep the indicator sho
ortuno
2016/03/31 17:53:25
OK. What do you think of the new approach?
|
| + // Another device is still connected. |
| + return; |
|
Jeffrey Yasskin
2016/03/31 16:18:43
For this sort of thing, I'd avoid returning early,
|
| + } |
| + |
| + // Indicate no more BT devices are connected. |
| + 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); |
| + } |
| } |
| } |