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

Unified Diff: chromeos/geolocation/simple_geolocation_provider.cc

Issue 1819173002: SimpleGeolocation should support sending WiFi AP data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update after review. Created 4 years, 9 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 e083b3edb0460b911f5c2e1398bfc8f75851dd52..0a26ede321131a3d8dea86f83b2f9cce025da639 100644
--- a/chromeos/geolocation/simple_geolocation_provider.cc
+++ b/chromeos/geolocation/simple_geolocation_provider.cc
@@ -9,6 +9,8 @@
#include "base/bind.h"
#include "chromeos/geolocation/geoposition.h"
+#include "chromeos/network/geolocation_handler.h"
+#include "chromeos/network/network_handler.h"
#include "net/url_request/url_request_context_getter.h"
namespace chromeos {
@@ -16,6 +18,20 @@ namespace chromeos {
namespace {
const char kDefaultGeolocationProviderUrl[] =
"https://www.googleapis.com/geolocation/v1/geolocate?";
+
+scoped_ptr<WifiAccessPointVector> GetAccessPointData() {
+ if (!chromeos::NetworkHandler::Get()->geolocation_handler()->wifi_enabled())
+ return nullptr;
+
+ scoped_ptr<WifiAccessPointVector> result(new chromeos::WifiAccessPointVector);
+ int64_t age_ms = 0;
+ if (!NetworkHandler::Get()->geolocation_handler()->GetWifiAccessPoints(
+ result.get(), &age_ms)) {
+ return nullptr;
+ }
+ return result;
+}
+
} // namespace
SimpleGeolocationProvider::SimpleGeolocationProvider(
@@ -30,10 +46,13 @@ SimpleGeolocationProvider::~SimpleGeolocationProvider() {
void SimpleGeolocationProvider::RequestGeolocation(
base::TimeDelta timeout,
+ bool send_wifi_access_points,
SimpleGeolocationRequest::ResponseCallback callback) {
DCHECK(thread_checker_.CalledOnValidThread());
- SimpleGeolocationRequest* request(
- new SimpleGeolocationRequest(url_context_getter_.get(), url_, timeout));
+
+ SimpleGeolocationRequest* request(new SimpleGeolocationRequest(
+ url_context_getter_.get(), url_, timeout,
+ send_wifi_access_points ? GetAccessPointData() : nullptr));
requests_.push_back(request);
// SimpleGeolocationProvider owns all requests. It is safe to pass unretained
« no previous file with comments | « chromeos/geolocation/simple_geolocation_provider.h ('k') | chromeos/geolocation/simple_geolocation_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698