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

Unified Diff: components/proximity_auth/proximity_monitor_impl.cc

Issue 1377313002: Revert of Hook up ProximityAuthSystem in EasyUnlockService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth_connection
Patch Set: Created 5 years, 3 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: components/proximity_auth/proximity_monitor_impl.cc
diff --git a/components/proximity_auth/proximity_monitor_impl.cc b/components/proximity_auth/proximity_monitor_impl.cc
index 702ea77e2b62b84ee57f31146a462d2e124a234d..432485c906599b3230477873863d3a755ebb8f89 100644
--- a/components/proximity_auth/proximity_monitor_impl.cc
+++ b/components/proximity_auth/proximity_monitor_impl.cc
@@ -32,8 +32,10 @@
const double kRssiSampleWeight = 0.3;
ProximityMonitorImpl::ProximityMonitorImpl(const RemoteDevice& remote_device,
- scoped_ptr<base::TickClock> clock)
+ scoped_ptr<base::TickClock> clock,
+ ProximityMonitorObserver* observer)
: remote_device_(remote_device),
+ observer_(observer),
strategy_(Strategy::NONE),
remote_device_is_in_proximity_(false),
is_active_(false),
@@ -110,14 +112,6 @@
metrics::RecordAuthProximityRemoteDeviceModelHash(remote_device_model);
}
-void ProximityMonitorImpl::AddObserver(ProximityMonitorObserver* observer) {
- observers_.AddObserver(observer);
-}
-
-void ProximityMonitorImpl::RemoveObserver(ProximityMonitorObserver* observer) {
- observers_.RemoveObserver(observer);
-}
-
void ProximityMonitorImpl::SetStrategy(Strategy strategy) {
if (strategy_ == strategy)
return;
@@ -218,10 +212,8 @@
}
void ProximityMonitorImpl::ClearProximityState() {
- if (is_active_ && remote_device_is_in_proximity_) {
- FOR_EACH_OBSERVER(ProximityMonitorObserver, observers_,
- OnProximityStateChanged());
- }
+ if (is_active_ && remote_device_is_in_proximity_)
+ observer_->OnProximityStateChanged();
remote_device_is_in_proximity_ = false;
rssi_rolling_average_.reset();
@@ -271,8 +263,7 @@
PA_LOG(INFO) << "[Proximity] Updated proximity state: "
<< (is_now_in_proximity ? "proximate" : "distant");
remote_device_is_in_proximity_ = is_now_in_proximity;
- FOR_EACH_OBSERVER(ProximityMonitorObserver, observers_,
- OnProximityStateChanged());
+ observer_->OnProximityStateChanged();
}
}
« no previous file with comments | « components/proximity_auth/proximity_monitor_impl.h ('k') | components/proximity_auth/proximity_monitor_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698