void WebGeolocationManagerProxy::setEnableHighAccuracy(CoreIPC::Connection* connection, bool enabled)
{
    bool highAccuracyWasEnabled = isHighAccuracyEnabled();

    if (enabled)
        m_highAccuracyRequesters.add(connection->client());
    else
        m_highAccuracyRequesters.remove(connection->client());

    bool highAccuracyShouldBeEnabled = isHighAccuracyEnabled();
    if (isUpdating() && highAccuracyWasEnabled != highAccuracyShouldBeEnabled)
        m_provider.setEnableHighAccuracy(this, highAccuracyShouldBeEnabled);
}
void WebGeolocationManager::setEnableHighAccuracyForPage(WebPage* page, bool enabled)
{
    bool highAccuracyWasEnabled = isHighAccuracyEnabled();

    if (enabled)
        m_highAccuracyPageSet.add(page);
    else
        m_highAccuracyPageSet.remove(page);

    bool highAccuracyShouldBeEnabled = isHighAccuracyEnabled();
    if (highAccuracyWasEnabled != highAccuracyShouldBeEnabled)
        m_process->parentProcessConnection()->send(Messages::WebGeolocationManagerProxy::SetEnableHighAccuracy(highAccuracyShouldBeEnabled), 0);
}
void WebGeolocationManager::unregisterWebPage(WebPage* page)
{
    bool highAccuracyWasEnabled = isHighAccuracyEnabled();

    m_pageSet.remove(page);
    m_highAccuracyPageSet.remove(page);

    if (!isUpdating())
        m_process->parentProcessConnection()->send(Messages::WebGeolocationManagerProxy::StopUpdating(), 0);
    else {
        bool highAccuracyShouldBeEnabled = isHighAccuracyEnabled();
        if (highAccuracyWasEnabled != highAccuracyShouldBeEnabled)
            m_process->parentProcessConnection()->send(Messages::WebGeolocationManagerProxy::SetEnableHighAccuracy(highAccuracyShouldBeEnabled), 0);
    }
}
void WebGeolocationManagerProxy::removeRequester(const CoreIPC::Connection::Client* client)
{
    bool wasUpdating = isUpdating();
    bool highAccuracyWasEnabled = isHighAccuracyEnabled();

    m_highAccuracyRequesters.remove(client);
    m_updateRequesters.remove(client);

    if (wasUpdating && !isUpdating())
        m_provider.stopUpdating(this);
    else {
        bool highAccuracyShouldBeEnabled = isHighAccuracyEnabled();
        if (highAccuracyShouldBeEnabled != highAccuracyWasEnabled)
            m_provider.setEnableHighAccuracy(this, highAccuracyShouldBeEnabled);
    }
}
void WebGeolocationManagerProxy::startUpdating(CoreIPC::Connection* connection)
{
    bool wasUpdating = isUpdating();
    m_updateRequesters.add(connection->client());
    if (!wasUpdating) {
        m_provider.setEnableHighAccuracy(this, isHighAccuracyEnabled());
        m_provider.startUpdating(this);
    }
}