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

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

Issue 1711393002: bluetooth: android: register for adapter on/off events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased on master Created 4 years, 10 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 22ad2c63fd955f1db5bb3032a2cc1020f01c2ff4..23985e041f8daa2177276f280e6b00dc8875f275 100644
--- a/content/browser/bluetooth/bluetooth_dispatcher_host.cc
+++ b/content/browser/bluetooth/bluetooth_dispatcher_host.cc
@@ -517,9 +517,21 @@ void BluetoothDispatcherHost::AdapterPoweredChanged(
&request_device_sessions_);
!iter.IsAtEnd(); iter.Advance()) {
RequestDeviceSession* session = iter.GetCurrentValue();
+
+ // Stop ongoing discovery session if power is off.
+ if (!powered && session->discovery_session) {
+ StopDiscoverySession(std::move(session->discovery_session));
+ }
+
if (session->chooser)
session->chooser->SetAdapterPresence(presence);
}
+
+ // Stop the timer so that we don't change the state of the chooser
+ // when timer expires.
+ if (!powered) {
+ discovery_session_timer_.Stop();
+ }
}
void BluetoothDispatcherHost::DeviceAdded(device::BluetoothAdapter* adapter,

Powered by Google App Engine
This is Rietveld 408576698