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

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

Issue 1746333002: bluetooth: Show tab indicator when BT device is connected (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: mute -> connected 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 b69fa4fa49f19a3632cda132998f947eec1a764d..378b4d13af849dd351b47111e8fc20df348787c8 100644
--- a/content/browser/bluetooth/bluetooth_dispatcher_host.cc
+++ b/content/browser/bluetooth/bluetooth_dispatcher_host.cc
@@ -696,8 +696,8 @@ void BluetoothDispatcherHost::OnGATTServerConnect(
query_result.device->CreateGattConnection(
base::Bind(&BluetoothDispatcherHost::OnGATTConnectionCreated,
- weak_ptr_on_ui_thread_, thread_id, request_id, device_id,
- start_time),
+ weak_ptr_on_ui_thread_, thread_id, request_id,
+ frame_routing_id, device_id, start_time),
base::Bind(&BluetoothDispatcherHost::OnCreateGATTConnectionError,
weak_ptr_on_ui_thread_, thread_id, request_id, device_id,
start_time));
@@ -722,6 +722,14 @@ 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)) {
@@ -1440,6 +1448,7 @@ void BluetoothDispatcherHost::FinishClosingChooser(
void BluetoothDispatcherHost::OnGATTConnectionCreated(
int thread_id,
int request_id,
+ int frame_routing_id,
const std::string& device_id,
base::TimeTicks start_time,
scoped_ptr<device::BluetoothGattConnection> connection) {
@@ -1447,6 +1456,13 @@ void BluetoothDispatcherHost::OnGATTConnectionCreated(
device_id_to_connection_map_[device_id] = std::move(connection);
RecordConnectGATTTimeSuccess(base::TimeTicks::Now() - start_time);
RecordConnectGATTOutcome(UMAConnectGATTOutcome::SUCCESS);
+ 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(true);
+ }
Send(new BluetoothMsg_GATTServerConnectSuccess(thread_id, request_id));
}
« no previous file with comments | « content/browser/bluetooth/bluetooth_dispatcher_host.h ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698