ladybird/Libraries/LibWeb/Geolocation/GeolocationCoordinates.cpp
Jelle Raaijmakers 71f03cb785 LibWeb: Implement emulated Geolocation position retrieval
This implements enough of the Geolocation spec that it is now possible
for websites to retrieve the current geo position or try to watch for
updates (which currently never happen).

As it stands now, it only returns a single emulated position that points
to San Francisco.
2025-06-24 11:33:41 +02:00

32 lines
757 B
C++

/*
* Copyright (c) 2025, Jelle Raaijmakers <jelle@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/GeolocationCoordinatesPrototype.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/Geolocation/GeolocationCoordinates.h>
namespace Web::Geolocation {
GC_DEFINE_ALLOCATOR(GeolocationCoordinates);
GeolocationCoordinates::GeolocationCoordinates(JS::Realm& realm)
: PlatformObject(realm)
{
}
GeolocationCoordinates::GeolocationCoordinates(JS::Realm& realm, CoordinatesData data)
: PlatformObject(realm)
, m_coordinates_data(move(data))
{
}
void GeolocationCoordinates::initialize(JS::Realm& realm)
{
WEB_SET_PROTOTYPE_FOR_INTERFACE(GeolocationCoordinates);
Base::initialize(realm);
}
}