#include "services/device/geolocation/network_location_provider.h"
#include <iterator>
#include <utility>
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/memory/scoped_refptr.h"
#include "base/ranges/algorithm.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/task_runner.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "components/device_event_log/device_event_log.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/device/geolocation/position_cache.h"
#include "services/device/public/cpp/device_features.h"
#include "services/device/public/cpp/geolocation/geoposition.h"
#include "services/device/public/cpp/geolocation/network_location_request_source.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#if BUILDFLAG(IS_APPLE)
#include "services/device/public/cpp/device_features.h"
#endif
namespace device {
namespace {
const int kDataCompleteWaitSeconds = …;
const int kLastPositionMaxAgeSeconds = …;
}
NetworkLocationProvider::NetworkLocationProvider(
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
const std::string& api_key,
PositionCache* position_cache,
base::RepeatingClosure internals_updated_closure,
NetworkRequestCallback network_request_callback,
NetworkResponseCallback network_response_callback)
: … { … }
NetworkLocationProvider::~NetworkLocationProvider() { … }
void NetworkLocationProvider::FillDiagnostics(
mojom::GeolocationDiagnostics& diagnostics) { … }
void NetworkLocationProvider::SetUpdateCallback(
const LocationProvider::LocationProviderUpdateCallback& callback) { … }
void NetworkLocationProvider::OnPermissionGranted() { … }
void NetworkLocationProvider::OnWifiDataUpdate() { … }
void NetworkLocationProvider::OnLocationResponse(
mojom::GeopositionResultPtr result,
bool server_error,
const WifiData& wifi_data,
mojom::NetworkLocationResponsePtr response_data) { … }
void NetworkLocationProvider::StartProvider(bool high_accuracy) { … }
void NetworkLocationProvider::StopProvider() { … }
const mojom::GeopositionResult* NetworkLocationProvider::GetPosition() { … }
void NetworkLocationProvider::RequestPosition() { … }
}