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

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: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+ }
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698