Skip to content

Commit

Permalink
[WPE][GTK] Implement portal-based geolocation
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=220253

Reviewed by Michael Catanzaro.

This turned into a somewhat messy patch, but the principle behind it is
to try and use the Location portal first, and fallback to the direct
Geoclue calls that it already does.

The Location portal has two particular steps: (1) create a geolocation
session, and (2) start the session and get geolocation updates.

Step 1 is where the location accuracy is set. For this reason, unlike
the direct Geoclue code path, we have to close and recreate the Location
portal session when high accuracy mode changes.

Talking about high accuracy mode, apparently the new value was never
stored into m_isHighAccuracyEnabled! This is fixed in this patch too.

Step 2 is where the Location session is started. Only after this call
that we'd receive geolocation position updates. In theory we'd be able
to pass a parent window handler in this step, and that would allow the
desktop environment to nicely place access control requests on it; that
is not currently supported by WebKit though, so just pass empty string
for now.

The destroy timer is used to release both Portal and Geoclue resources
so name the timer and the corresponding methods to match that. Also
rename Geoclue-specific methods to explicitly mention Geoclue, which
helps following the callback chain.

* Source/WebKit/UIProcess/geoclue/GeoclueGeolocationProvider.cpp:
(WebKit::GeoclueGeolocationProvider::GeoclueGeolocationProvider):
(WebKit::GeoclueGeolocationProvider::start):
(WebKit::GeoclueGeolocationProvider::stop):
(WebKit::GeoclueGeolocationProvider::setEnableHighAccuracy):
(WebKit::GeoclueGeolocationProvider::destroyStateLater):
(WebKit::GeoclueGeolocationProvider::destroyState):
(WebKit::GeoclueGeolocationProvider::acquirePortalProxy):
(WebKit::GeoclueGeolocationProvider::setupPortalProxy):
(WebKit::GeoclueGeolocationProvider::createPortalSession):
(WebKit::GeoclueGeolocationProvider::startPortalSession):
(WebKit::GeoclueGeolocationProvider::portalLocationUpdated):
(WebKit::GeoclueGeolocationProvider::stopPortalSession):
(WebKit::GeoclueGeolocationProvider::createGeoclueManager):
(WebKit::GeoclueGeolocationProvider::setupGeoclueManager):
(WebKit::GeoclueGeolocationProvider::createGeoclueClient):
(WebKit::GeoclueGeolocationProvider::setupGeoclueClient):
(WebKit::GeoclueGeolocationProvider::startGeoclueClient):
(WebKit::GeoclueGeolocationProvider::stopGeoclueClient):
(WebKit::GeoclueGeolocationProvider::requestAccuracyLevel):
(WebKit::GeoclueGeolocationProvider::destroyManagerLater): Deleted.
(WebKit::GeoclueGeolocationProvider::destroyManager): Deleted.
(WebKit::GeoclueGeolocationProvider::setupManager): Deleted.
(WebKit::GeoclueGeolocationProvider::createClient): Deleted.
(WebKit::GeoclueGeolocationProvider::setupClient): Deleted.
(WebKit::GeoclueGeolocationProvider::startClient): Deleted.
(WebKit::GeoclueGeolocationProvider::stopClient): Deleted.
* Source/WebKit/UIProcess/geoclue/GeoclueGeolocationProvider.h:

Canonical link: https://commits.webkit.org/275746@main
  • Loading branch information
GeorgesStavracas authored and mcatanzaro committed Mar 6, 2024
1 parent 2e156b8 commit 18a97d2
Show file tree
Hide file tree
Showing 2 changed files with 347 additions and 79 deletions.
Loading

0 comments on commit 18a97d2

Please sign in to comment.