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

Unified Diff: chromeos/geolocation/simple_geolocation_provider.cc

Issue 2624843003: Add support for cellular geolocation (Closed)
Patch Set: Use cell tower info in SimpleGeolocationProvider. Created 3 years, 11 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: chromeos/geolocation/simple_geolocation_provider.cc
diff --git a/chromeos/geolocation/simple_geolocation_provider.cc b/chromeos/geolocation/simple_geolocation_provider.cc
index 45d6981dcb8b08bdf1d25cbf8ec6dc848915c429..e6e2445e4d9a3e112e1e981807006fed59190207 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;
+ }
+
+ std::unique_ptr<CellTowerVector> result(new chromeos::CellTowerVector);
Ben Chan 2017/02/02 20:49:24 auto result = base::MakeUnique<chromeos::CellTower
can Skylar cook 2017/02/03 00:15:17 Done.
+ 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));
requests_.push_back(base::WrapUnique(request));
// SimpleGeolocationProvider owns all requests. It is safe to pass unretained

Powered by Google App Engine
This is Rietveld 408576698