0

[DNS] Add a new content setting

Add a new REVOKED_DISRUPTIVE_NOTIFICATION_PERMISSIONS content setting.
It will be used to store the revoked (or potentially revoked) sites that
have been sending disruptive notifications.

After revocation, the users will receive a notification and the list of
revoked websites will be available in Safety Hub.

For more details, see go/dns-dd.

Bug: 397363276
Change-Id: Iec9b8be940140e4daa80e877db51452109a8c2b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6276093
Reviewed-by: Antonio Sartori <antoniosartori@chromium.org>
Reviewed-by: Robbie McElrath <rmcelrath@chromium.org>
Reviewed-by: Christian Dullweber <dullweber@chromium.org>
Commit-Queue: Olesia Marukhno <olesiamarukhno@google.com>
Reviewed-by: Martin Šrámek <msramek@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1423872}
This commit is contained in:
Olesia Marukhno
2025-02-24 06:17:06 -08:00
committed by Chromium LUCI CQ
parent 3a27a27c57
commit 714a06233a
8 changed files with 19 additions and 1 deletions
chrome
android
javatests
src
org
chromium
chrome
browser
components/content_settings/core
tools/metrics/histograms

@ -707,7 +707,7 @@ public class WebsitePermissionsFetcherTest {
// Otherwise, just update count in the assert.
// TODO(https://b/332704817): Add test for Tracking Protection content setting after Android
// integration.
assertEquals(117, ContentSettingsType.MAX_VALUE);
assertEquals(118, ContentSettingsType.MAX_VALUE);
websitePreferenceBridge.addContentSettingException(
new ContentSettingException(
ContentSettingsType.COOKIES,

@ -897,6 +897,10 @@ void ChromeBrowsingDataRemoverDelegate::RemoveEmbedderData(
ContentSettingsType::REVOKED_ABUSIVE_NOTIFICATION_PERMISSIONS,
delete_begin_, delete_end_, website_settings_filter);
host_content_settings_map_->ClearSettingsForOneTypeWithPredicate(
ContentSettingsType::REVOKED_DISRUPTIVE_NOTIFICATION_PERMISSIONS,
delete_begin_, delete_end_, website_settings_filter);
host_content_settings_map_->ClearSettingsForOneTypeWithPredicate(
ContentSettingsType::NOTIFICATION_PERMISSION_REVIEW, delete_begin_,
delete_end_, website_settings_filter);

@ -196,6 +196,7 @@ TEST_F(ControlledFramePermissionsTest, Verify) {
case ContentSettingsType::
ARE_SUSPICIOUS_NOTIFICATIONS_ALLOWLISTED_BY_USER:
case ContentSettingsType::CONTROLLED_FRAME:
case ContentSettingsType::REVOKED_DISRUPTIVE_NOTIFICATION_PERMISSIONS:
break;
default:

@ -247,6 +247,7 @@ constexpr auto kContentSettingsTypeGroupNames = std::to_array<
{ContentSettingsType::CONTROLLED_FRAME, nullptr},
// POINTER_LOCK has been deprecated.
{ContentSettingsType::POINTER_LOCK, nullptr},
{ContentSettingsType::REVOKED_DISRUPTIVE_NOTIFICATION_PERMISSIONS, nullptr},
});
static_assert(

@ -153,6 +153,7 @@ constexpr auto kHistogramValue = base::MakeFixedFlatMap<ContentSettingsType,
{ContentSettingsType::ARE_SUSPICIOUS_NOTIFICATIONS_ALLOWLISTED_BY_USER,
132},
{ContentSettingsType::CONTROLLED_FRAME, 133},
{ContentSettingsType::REVOKED_DISRUPTIVE_NOTIFICATION_PERMISSIONS, 134},
// As mentioned at the top, please don't forget to update ContentType in
// enums.xml when you add entries here!

@ -326,6 +326,12 @@ void WebsiteSettingsRegistry::Init() {
WebsiteSettingsInfo::GENERIC_SINGLE_ORIGIN_SCOPE,
DESKTOP | PLATFORM_ANDROID,
WebsiteSettingsInfo::DONT_INHERIT_IN_INCOGNITO);
Register(ContentSettingsType::REVOKED_DISRUPTIVE_NOTIFICATION_PERMISSIONS,
"disruptive-notification-permissions", base::Value(),
WebsiteSettingsInfo::UNSYNCABLE, WebsiteSettingsInfo::NOT_LOSSY,
WebsiteSettingsInfo::GENERIC_SINGLE_ORIGIN_SCOPE,
DESKTOP | PLATFORM_ANDROID,
WebsiteSettingsInfo::DONT_INHERIT_IN_INCOGNITO);
}
} // namespace content_settings

@ -475,5 +475,9 @@ enum ContentSettingsType {
// Content settings for access to the Controlled Frame API.
CONTROLLED_FRAME,
// Website setting which is used for UnusedSitePermissionsService to
// store revoked notification permissions of disruptive sites.
REVOKED_DISRUPTIVE_NOTIFICATION_PERMISSIONS,
};
// LINT.ThenChange(//components/content_settings/core/browser/content_settings_uma_util.cc:kHistogramValue)

@ -2751,6 +2751,7 @@ Called by update_net_error_codes.py.-->
<int value="131" label="Legacy cookie scope"/>
<int value="132" label="Are suspicious notifications allowlisted by user"/>
<int value="133" label="Controlled Frame"/>
<int value="134" label="Revoked disruptive notification permissions"/>
</enum>
<!-- LINT.ThenChange(//components/content_settings/core/browser/content_settings_uma_util.cc:kHistogramValue) -->