Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Unified Diff: content/browser/bluetooth/bluetooth_dispatcher_host.cc

Issue 1848663002: bluetooth: Remove indicator only when there are no more devices connected (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Ref count connections Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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));
}

Powered by Google App Engine
This is Rietveld 408576698