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

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: 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 e5b96d93df90afdb7f89ceea2fdcf5350cc6cea2..3a8a44ef2601d9440ebc4c11e6b074da4d222081 100644
--- a/content/browser/bluetooth/bluetooth_dispatcher_host.cc
+++ b/content/browser/bluetooth/bluetooth_dispatcher_host.cc
@@ -486,9 +486,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