Index: components/proximity_auth/proximity_monitor_impl.h |
diff --git a/components/proximity_auth/proximity_monitor_impl.h b/components/proximity_auth/proximity_monitor_impl.h |
index 1f0e8a20c6381cc3cf14e54d4924812368a78055..28398830794a6e44295b96d4a2a2bd468a6b5b4c 100644 |
--- a/components/proximity_auth/proximity_monitor_impl.h |
+++ b/components/proximity_auth/proximity_monitor_impl.h |
@@ -9,6 +9,7 @@ |
#include "base/memory/ref_counted.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/memory/weak_ptr.h" |
+#include "base/observer_list.h" |
#include "components/proximity_auth/proximity_monitor.h" |
#include "components/proximity_auth/remote_device.h" |
#include "device/bluetooth/bluetooth_device.h" |
@@ -31,8 +32,7 @@ class ProximityMonitorImpl : public ProximityMonitor { |
public: |
// The |observer| is not owned, and must outlive |this| instance. |
ProximityMonitorImpl(const RemoteDevice& remote_device, |
- scoped_ptr<base::TickClock> clock, |
- ProximityMonitorObserver* observer); |
+ scoped_ptr<base::TickClock> clock); |
~ProximityMonitorImpl() override; |
// ProximityMonitor: |
@@ -42,6 +42,8 @@ class ProximityMonitorImpl : public ProximityMonitor { |
bool IsUnlockAllowed() const override; |
bool IsInRssiRange() const override; |
void RecordProximityMetricsOnAuthSuccess() override; |
+ void AddObserver(ProximityMonitorObserver* observer) override; |
+ void RemoveObserver(ProximityMonitorObserver* observer) override; |
protected: |
// Sets the proximity detection strategy. Exposed for testing. |
@@ -97,13 +99,14 @@ class ProximityMonitorImpl : public ProximityMonitor { |
const device::BluetoothDevice::ConnectionInfo& connection_info); |
// Checks whether the proximity state has changed based on the current |
- // samples. Notifies the |observer_| on a change. |
+ // samples. Notifies |observers_| on a change. |
void CheckForProximityStateChange(); |
+ // The remote device being monitored. |
const RemoteDevice remote_device_; |
- // The |observer_| is not owned, and must outlive |this| instance. |
- ProximityMonitorObserver* observer_; |
+ // The observers attached to the ProximityMonitor. |
+ base::ObserverList<ProximityMonitorObserver> observers_; |
// The Bluetooth adapter that will be polled for connection info. |
scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_; |