#ifndef SERVICES_DEVICE_GEOLOCATION_GEOLOCATION_CONTEXT_H_
#define SERVICES_DEVICE_GEOLOCATION_GEOLOCATION_CONTEXT_H_
#include <memory>
#include <vector>
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "services/device/public/mojom/geolocation.mojom.h"
#include "services/device/public/mojom/geolocation_client_id.mojom.h"
#include "services/device/public/mojom/geolocation_context.mojom.h"
#include "services/device/public/mojom/geoposition.mojom.h"
#include "url/origin.h"
namespace device {
class GeolocationImpl;
class GeolocationContext : public mojom::GeolocationContext {
public:
GeolocationContext();
GeolocationContext(const GeolocationContext&) = delete;
GeolocationContext& operator=(const GeolocationContext&) = delete;
~GeolocationContext() override;
static void Create(mojo::PendingReceiver<mojom::GeolocationContext> receiver);
void BindGeolocation(mojo::PendingReceiver<mojom::Geolocation> receiver,
const GURL& requesting_url,
mojom::GeolocationClientId client_id,
bool has_precise_permission) override;
void OnPermissionUpdated(
const url::Origin& origin,
mojom::GeolocationPermissionLevel permission_level) override;
void SetOverride(mojom::GeopositionResultPtr geoposition_result) override;
void ClearOverride() override;
void OnConnectionError(GeolocationImpl* impl);
private:
std::vector<std::unique_ptr<GeolocationImpl>> impls_;
mojom::GeopositionResultPtr geoposition_override_;
};
}
#endif