| 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 c7a2dd3c5d1d75e97a7c619156e51d6fee24e341..fb29da994c496bb6a60fe5caa726dc9e3311a1be 100644
|
| --- a/content/browser/bluetooth/bluetooth_dispatcher_host.cc
|
| +++ b/content/browser/bluetooth/bluetooth_dispatcher_host.cc
|
| @@ -707,18 +707,26 @@ void BluetoothDispatcherHost::OnGATTServerDisconnect(
|
| // option to disconnect than closing the tab, we purposefully don't
|
| // check if the frame has permission to interact with the 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->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;
|
| +
|
| + // This only catches disconnections from the renderer. If the device
|
| + // disconnects by itself, or the renderer frame has been deleted
|
| + // due to navigation, we will not hide the indicator.
|
| + // TODO(ortuno): Once we move to Frame and Mojo we will be able
|
| + // to observe the frame's lifetime and hide the indicator when necessary.
|
| + // http://crbug.com/508771
|
| +
|
| + // 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();
|
| + }
|
| }
|
| }
|
|
|
| @@ -1415,7 +1423,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));
|
| }
|
|
|