Chromium Code Reviews| Index: chromeos/geolocation/simple_geolocation_provider.cc |
| diff --git a/chromeos/geolocation/simple_geolocation_provider.cc b/chromeos/geolocation/simple_geolocation_provider.cc |
| index 45d6981dcb8b08bdf1d25cbf8ec6dc848915c429..a030ecf62b7f15bd233d0bc06333bad68c22c1e0 100644 |
| --- a/chromeos/geolocation/simple_geolocation_provider.cc |
| +++ b/chromeos/geolocation/simple_geolocation_provider.cc |
| @@ -34,6 +34,22 @@ std::unique_ptr<WifiAccessPointVector> GetAccessPointData() { |
| return result; |
| } |
| +std::unique_ptr<CellTowerVector> GetCellTowerData() { |
| + if (!chromeos::NetworkHandler::Get() |
| + ->geolocation_handler() |
| + ->cellular_enabled()) { |
| + return nullptr; |
| + } |
| + |
| + auto result = base::MakeUnique<chromeos::CellTowerVector>(); |
| + int64_t age_ms = 0; |
| + if (!NetworkHandler::Get()->geolocation_handler()->GetCellTowers(result.get(), |
| + &age_ms)) { |
| + return nullptr; |
| + } |
| + return result; |
| +} |
| + |
| } // namespace |
| SimpleGeolocationProvider::SimpleGeolocationProvider( |
| @@ -49,12 +65,14 @@ SimpleGeolocationProvider::~SimpleGeolocationProvider() { |
| void SimpleGeolocationProvider::RequestGeolocation( |
| base::TimeDelta timeout, |
| bool send_wifi_access_points, |
| + bool send_cell_towers, |
| SimpleGeolocationRequest::ResponseCallback callback) { |
| DCHECK(thread_checker_.CalledOnValidThread()); |
| SimpleGeolocationRequest* request(new SimpleGeolocationRequest( |
| url_context_getter_.get(), url_, timeout, |
| - send_wifi_access_points ? GetAccessPointData() : nullptr)); |
| + send_wifi_access_points ? GetAccessPointData() : nullptr, |
| + send_cell_towers ? GetCellTowerData() : nullptr)); |
|
Alexander Alekseev
2017/02/06 23:24:53
This is not optimal, as both GetAccessPointData()
can Skylar cook
2017/02/07 21:32:39
Good catch, agreed! I think it's useful to expose
stevenjb
2017/02/07 21:37:53
That is a good point, each of these does send an i
|
| requests_.push_back(base::WrapUnique(request)); |
| // SimpleGeolocationProvider owns all requests. It is safe to pass unretained |