#ifndef SERVICES_DEVICE_GEOLOCATION_PUBLIC_IP_ADDRESS_GEOLOCATOR_H_
#define SERVICES_DEVICE_GEOLOCATION_PUBLIC_IP_ADDRESS_GEOLOCATOR_H_
#include <string>
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/time/time.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/device/geolocation/public_ip_address_location_notifier.h"
#include "services/device/public/mojom/geolocation.mojom.h"
#include "services/device/public/mojom/geolocation_client_id.mojom.h"
#include "services/device/public/mojom/geoposition.mojom.h"
namespace device {
class PublicIpAddressLocationNotifier;
class PublicIpAddressGeolocator : public mojom::Geolocation {
public:
using BadMessageCallback =
base::RepeatingCallback<void(const std::string& message)>;
PublicIpAddressGeolocator(const net::PartialNetworkTrafficAnnotationTag tag,
PublicIpAddressLocationNotifier* notifier,
mojom::GeolocationClientId client_id,
BadMessageCallback callback);
PublicIpAddressGeolocator(const PublicIpAddressGeolocator&) = delete;
PublicIpAddressGeolocator& operator=(const PublicIpAddressGeolocator&) =
delete;
~PublicIpAddressGeolocator() override;
private:
void QueryNextPosition(QueryNextPositionCallback callback) override;
void SetHighAccuracyHint(bool high_accuracy) override;
void OnPositionUpdate(mojom::GeopositionResultPtr result);
QueryNextPositionCallback query_next_position_callback_;
base::Time last_updated_timestamp_;
const raw_ptr<PublicIpAddressLocationNotifier, DanglingUntriaged> notifier_;
const mojom::GeolocationClientId client_id_;
std::unique_ptr<const net::PartialNetworkTrafficAnnotationTag>
network_traffic_annotation_tag_;
BadMessageCallback bad_message_callback_;
};
}
#endif