Chromium Code Reviews| Index: device/geolocation/fake_location_provider.cc |
| diff --git a/device/geolocation/fake_location_provider.cc b/device/geolocation/fake_location_provider.cc |
| index 18e25694bbc2652acee1c95db2e9fa5cae511967..94fbe0dbff0cb043da29d44c790567376957cc15 100644 |
| --- a/device/geolocation/fake_location_provider.cc |
| +++ b/device/geolocation/fake_location_provider.cc |
| @@ -29,7 +29,9 @@ void FakeLocationProvider::HandlePositionChanged(const Geoposition& position) { |
| // The location arbitrator unit tests rely on this method running |
| // synchronously. |
| position_ = position; |
| - NotifyCallback(position_); |
| + if (!callback_.is_null()) { |
|
Michael van Ouwerkerk
2016/08/31 09:44:37
nit: no need for curly braces for this one-line bo
CJ
2016/08/31 17:22:11
Done.
|
| + callback_.Run(this, position_); |
| + } |
| } else { |
| provider_task_runner_->PostTask( |
| FROM_HERE, base::Bind(&FakeLocationProvider::HandlePositionChanged, |
| @@ -37,6 +39,11 @@ void FakeLocationProvider::HandlePositionChanged(const Geoposition& position) { |
| } |
| } |
| +void FakeLocationProvider::SetUpdateCallback( |
| + const LocationProviderUpdateCallback& callback) { |
| + callback_ = callback; |
| +} |
| + |
| bool FakeLocationProvider::StartProvider(bool high_accuracy) { |
| state_ = high_accuracy ? HIGH_ACCURACY : LOW_ACCURACY; |
| return true; |