void GeolocationPermissionClientQt::setPermission(QWebFrame* webFrame, QWebPage::PermissionPolicy permission)
{  
    if (!m_pendingPermissionRequests.contains(webFrame)) 
        return;

    Geolocation* listener = m_pendingPermissionRequests.value(webFrame);

    if (permission == QWebPage::PermissionGrantedByUser)
        listener->setIsAllowed(true);
    else if (permission == QWebPage::PermissionDeniedByUser)
        listener->setIsAllowed(false);
    else
        return;

    m_pendingPermissionRequests.remove(webFrame);
}
void GeolocationPermissionRequestManager::didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed)
{
    IDToGeolocationMap::iterator it = m_idToGeolocationMap.find(geolocationID);
    if (it == m_idToGeolocationMap.end())
        return;

    Geolocation* geolocation = it->value;
    geolocation->setIsAllowed(allowed);

    m_idToGeolocationMap.remove(it);
    m_geolocationToIDMap.remove(geolocation);
}
void GeolocationPermissions::maybeCallbackFrames(String origin, bool allow)
{
    // We can't track which frame issued the request, as frames can be deleted
    // or have their contents replaced. Even uniqueChildName is not unique when
    // frames are dynamically deleted and created. Instead, we simply call back
    // to the Geolocation object in all frames from the correct origin.
    for (Frame* frame = m_mainFrame; frame; frame = frame->tree()->traverseNext()) {
        if (origin == frame->document()->securityOrigin()->toString()) {
            // If the page has changed, it may no longer have a Geolocation
            // object.
            Geolocation* geolocation = frame->domWindow()->navigator()->optionalGeolocation();
            if (geolocation)
                geolocation->setIsAllowed(allow);
        }
    }
}
void GeolocationControllerClientBlackBerry::onPermission(void* context, bool isAllowed)
{
    Geolocation* position = static_cast<Geolocation*>(context);
    position->setIsAllowed(isAllowed);
}