| 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
|
|
|