[webkit-gtk] WK2: Adapting the Policy Decision Framework for Geolocation

Carlos Garcia Campos cgarcia at igalia.com
Mon Apr 2 23:59:53 PDT 2012

El lun, 02-04-2012 a las 15:42 -0700, Martin Robinson escribió:
> I like the approach in option 1, but I think that we can scrap the
> GObject interface with an abstract C++ class in the private data
> portion of the WebKitPolicyDecision object. Since this issue is only
> an implementation detail, I think we should avoid completely exposing
> it in the API.

It's not just an implementation detail, Mario is concerned of exposing a
download method in the API for policy decisions where it doesn't make
sense to download anything. His approach moves the download method down
the hierarchy so that it can only be used with Navigation and Request
policy decisions.

>  The creation of the WebKitFramePolicyDecision class is
> an artificial result of this implementation detail. I'm not sure if
> makes sense either, since geolocation requests are also associated
> with frames. Sometimes naming problems point to real design problems.

Agree. We should think of better names.

> Here's a more concrete explanation of what I'm suggesting with the
> caveat that the names I'm choosing are terrible. :)
> class PolicyDecisionDecisionListener {
> public:
>     void accept() = 0;
>     void reject() = 0;
>     void download() = 0;
> }

This still has the download() in the parent abstract class.

> class CAPIPolicyDecisionListener {
> private:
>    WKRetainPtr<WKFramePolicyListenerRef> m_listener;
> public:
>     void accept() {
>         WKFramePolicyListenerUse(m_listener.get());
>     }
>   ...etc...
> }
> class GeolocationPolicyDecisionListener {
> private:
>     WKRetainPtr<WKGeolocationPermissionRequestRef> m_request;
> public:
>     void accept() {
>        WKGeolocationPermissionRequestAllow(m_request.get());
>     }
>   ...etc...
> }
> In WebKitPolicyDecision.cpp:
> struct _WebKitPolicyDecisionPrivate {
>     OwnPtr<PolicyDecisionDecisionListener> listener;
>     bool madePolicyDecision;
> };
> Here are the benefits I see to this approach:
> 1. It's less code.
> 2. The API does not bleed details of the implementation.

I don't think the problem is a matter of using C or C++, this solution
would be the same than the first one I proposed, but a bit more elegant
using C++ internally instead of having both the listener and the
geolocation request in WebKitPolicyDecisionPrivate. As I said I'm fine
with this solution, but it doesn't solve the problem Mario is worried

Carlos Garcia Campos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.webkit.org/pipermail/webkit-gtk/attachments/20120403/63ea97e3/attachment-0001.bin>

More information about the webkit-gtk mailing list