ladybird/Libraries/LibWeb/GPC/GlobalPrivacyControl.cpp
Timothy Flynn b4df857a57 LibWeb+LibWebView+WebContent: Replace DNT with GPC
Global Privacy Control aims to be a replacement for Do Not Track. DNT
ended up not being a great solution, as it wasn't enforced by law. This
actually resulted in the DNT header serving as an extra fingerprinting
data point.

GPC is becoming enforced by law in USA states such as California and
Colorado. CA is further working on a bill which requires that browsers
implement such an opt-out preference signal (OOPS):

https://cppa.ca.gov/announcements/2025/20250911.html

This patch replaces DNT with GPC and hooks up the associated settings.
2025-09-16 10:38:20 +02:00

21 lines
615 B
C++

/*
* Copyright (c) 2025, Tim Flynn <trflynn89@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/GPC/GlobalPrivacyControl.h>
#include <LibWeb/Loader/ResourceLoader.h>
namespace Web::GlobalPrivacyControl {
GlobalPrivacyControlMixin::~GlobalPrivacyControlMixin() = default;
// https://w3c.github.io/gpc/#dom-globalprivacycontrol-globalprivacycontrol
bool GlobalPrivacyControlMixin::global_privacy_control() const
{
// The value is false if no Sec-GPC header field would be sent; otherwise, the value is true.
return ResourceLoader::the().enable_global_privacy_control();
}
}