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

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: Address jyasskin's comments Created 4 years, 8 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 71f66c3f8083cded7e21ab6bc9cd23c1b93de6cf..8827894b6288e86bf0e9f1cd7bc35c4f5c1f676d 100644
--- a/content/browser/bluetooth/bluetooth_dispatcher_host.cc
+++ b/content/browser/bluetooth/bluetooth_dispatcher_host.cc
@@ -712,18 +712,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.
Jeffrey Yasskin 2016/04/06 23:05:13 Add a TODO here saying that this can miss disconne
ortuno 2016/04/07 15:09:20 Done.
+ 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();
+ }
}
}
@@ -1420,7 +1421,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