[ApproximateLocation] Add approximate location setting into site settings page. [chromium/src : main]

0 views
Skip to first unread message

Yifan Luo (Gerrit)

unread,
Apr 29, 2026, 1:02:23 PM (6 days ago) Apr 29
to Antonio Sartori, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, srahim...@chromium.org, dullweb...@chromium.org, msrame...@chromium.org
Attention needed from Antonio Sartori

Yifan Luo added 1 comment

Patchset-level comments
File-level comment, Patchset 4 (Latest):
Yifan Luo . resolved

+Antonio: Would you mind taking a look?

Open in Gerrit

Related details

Attention is currently required from:
  • Antonio Sartori
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia4b88a05c18da191fe2367a79a8fafee8d3cea12
Gerrit-Change-Number: 7782149
Gerrit-PatchSet: 4
Gerrit-Owner: Yifan Luo <l...@chromium.org>
Gerrit-Reviewer: Antonio Sartori <antonio...@chromium.org>
Gerrit-Reviewer: Yifan Luo <l...@chromium.org>
Gerrit-Attention: Antonio Sartori <antonio...@chromium.org>
Gerrit-Comment-Date: Wed, 29 Apr 2026 17:02:04 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Antonio Sartori (Gerrit)

unread,
Apr 30, 2026, 2:51:19 AM (5 days ago) Apr 30
to Yifan Luo, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, asvitki...@chromium.org, jmedle...@chromium.org, srahim...@chromium.org, dullweb...@chromium.org, msrame...@chromium.org
Attention needed from Yifan Luo

Antonio Sartori added 12 comments

Patchset-level comments
File-level comment, Patchset 6 (Latest):
Antonio Sartori . resolved

Thanks! some comments below.

File chrome/browser/about_flags.cc
Line 3960, Patchset 6 (Latest):const FeatureEntry::FeatureParam kApproximateGeolocationPermissionArm1Params[] =
Antonio Sartori . unresolved

This is for the 6 variants of the prompt, which won't exist on desktop. Can we just have an on-off chrome://flag on desktop?

File chrome/browser/resources/settings/site_settings/site_details_permission.html
Line 47, Patchset 6 (Latest): <select id="geolocationPermission" class="md-select"
hidden$="[[!isApproximateGeolocationPermission()]]"
aria-label$="[[label]]"
aria-describedby="permissionSecondary"
on-change="onGeolocationPermissionSelectionChange_"
disabled$="[[!isPermissionUserControlled_(site.source, category,
site.setting, systemPermissionWarningKey_)]]">
<option id="default" value="ask">
$i18n{siteSettingsActionAskDefault}
</option>
<option id="approximate"
value="approximate">
$i18n{siteSettingsActionAllowApproximate}
</option>
<option id="precise" value="precise">
$i18n{siteSettingsActionAllowPrecise}
</option>
<option id="block" value="block">
$i18n{siteSettingsActionBlock}
</option>
</select>
Antonio Sartori . unresolved

I don't have a strong opinion here, but this kind of duplicates the permission select below. What we seem to do in general is to have the <select id="permission"> below and control what it shows and what it doesn't show with the various funcionts `showAllowedSetting_` and `showAskSetting_` etc.

Maybe we should do the same? Add an option for approximate below and reuse allow for precise while changing its label?

File chrome/browser/ui/webui/settings/recent_site_settings_helper.cc
Line 62, Patchset 6 (Latest): if (content_type == ContentSettingsType::GEOLOCATION_WITH_OPTIONS) {
Antonio Sartori . unresolved

Can you create a bug and add a TODO here that we should take care of this?

File chrome/browser/ui/webui/settings/site_settings_handler.cc
Line 1654, Patchset 6 (Latest): CHECK(content_settings::ContentSettingFromString(
Antonio Sartori . unresolved

Can't we just rename this `PermissionSettingFromString`, have it take a `PermissionSetting` and implement the logic inside the function depending on whether it gets a ContentSetting or a GeolocaitonSetting using `std::visit` (like here https://source.chromium.org/chromium/chromium/src/+/main:components/omnibox/browser/geolocation_header_service.cc;l=193;drc=c8b8e953163e6d035fc4e1bc4b32ec94c458dba8)

Line 1706, Patchset 6 (Latest): if ((content_type == ContentSettingsType::GEOLOCATION_WITH_OPTIONS &&
value == "block") ||
(content_type != ContentSettingsType::GEOLOCATION_WITH_OPTIONS &&
setting != PermissionSetting{CONTENT_SETTING_BLOCK})) {
Antonio Sartori . unresolved

The way to do this easily is e.g.

`PermissionSettingsRegistry::GetInstance()->Get(content_type)->delegate().IsBlocked(setting)`

which works for all permissions.

Line 1727, Patchset 6 (Latest): if (content_type != ContentSettingsType::GEOLOCATION_WITH_OPTIONS &&
Antonio Sartori . unresolved

just a note that this shouldn't be necessary anymore after https://crrev.com/c/7796856 lands

Line 1737, Patchset 6 (Latest): if (content_type != ContentSettingsType::GEOLOCATION_WITH_OPTIONS) {
Antonio Sartori . unresolved

can you just check here if this is NOTIFICATIONS and remove that check from MaybeLogSafeBrowsing...?

Otherwise pass a PermissionSetting to MaybeLog... and remove the check here.

Line 1791, Patchset 6 (Latest): bool mute = (setting == PermissionSetting{CONTENT_SETTING_BLOCK}) ||
Antonio Sartori . unresolved

let's just define `ContentSetting content_setting = std::get<ContentSetting>(setting)` here.

File chrome/browser/ui/webui/settings/site_settings_helper.cc
Line 674, Patchset 6 (Latest): if (base::FeatureList::IsEnabled(
content_settings::features::kApproximateGeolocationPermission)) {
base_types->push_back(ContentSettingsType::GEOLOCATION_WITH_OPTIONS);
} else {
base_types->push_back(ContentSettingsType::GEOLOCATION);
}
Antonio Sartori . unresolved

`base_types->push_back(content_settings::GeolocationContentSettingsType())`

Line 1261, Patchset 6 (Latest): permissions::PermissionUtil::PermissionSettingToPermissionStatus(setting),
Antonio Sartori . unresolved

we shouldn't have this function because there is no proper way of converting a PermissionSetting into a PermissionStatus. The information of the granularity granted is lost.

To compare, here is the analogous function for android: https://source.chromium.org/chromium/chromium/src/+/main:components/browser_ui/site_settings/android/website_preference_bridge.cc;l=270;drc=a2de7835eb6515901e1165988ff1b1a918581785

Seems much easier. I have to understand why this is so complicated here and how we can get around it.

File chrome/test/data/webui/settings/site_details_test.ts
Line 346, Patchset 6 (Latest): ContentSettingsTypes.GEOLOCATION_WITH_OPTIONS) {
Antonio Sartori . unresolved

let's add a version of this test for GEOLOCATION_WITH_OPTIONS

Open in Gerrit

Related details

Attention is currently required from:
  • Yifan Luo
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ia4b88a05c18da191fe2367a79a8fafee8d3cea12
    Gerrit-Change-Number: 7782149
    Gerrit-PatchSet: 6
    Gerrit-Owner: Yifan Luo <l...@chromium.org>
    Gerrit-Reviewer: Antonio Sartori <antonio...@chromium.org>
    Gerrit-Reviewer: Yifan Luo <l...@chromium.org>
    Gerrit-Attention: Yifan Luo <l...@chromium.org>
    Gerrit-Comment-Date: Thu, 30 Apr 2026 06:50:58 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Yifan Luo (Gerrit)

    unread,
    7:18 AM (1 hour ago) 7:18 AM
    to Antonio Sartori, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, asvitki...@chromium.org, jmedle...@chromium.org, srahim...@chromium.org, dullweb...@chromium.org, msrame...@chromium.org
    Attention needed from Antonio Sartori

    Yifan Luo added 8 comments

    File chrome/browser/about_flags.cc
    Line 3960, Patchset 6:const FeatureEntry::FeatureParam kApproximateGeolocationPermissionArm1Params[] =
    Antonio Sartori . resolved

    This is for the 6 variants of the prompt, which won't exist on desktop. Can we just have an on-off chrome://flag on desktop?

    File chrome/browser/ui/webui/settings/recent_site_settings_helper.cc
    Line 62, Patchset 6: if (content_type == ContentSettingsType::GEOLOCATION_WITH_OPTIONS) {
    Antonio Sartori . resolved

    Can you create a bug and add a TODO here that we should take care of this?

    Yifan Luo

    Done

    File chrome/browser/ui/webui/settings/site_settings_handler.cc
    Line 1654, Patchset 6: CHECK(content_settings::ContentSettingFromString(
    Antonio Sartori . resolved

    Can't we just rename this `PermissionSettingFromString`, have it take a `PermissionSetting` and implement the logic inside the function depending on whether it gets a ContentSetting or a GeolocaitonSetting using `std::visit` (like here https://source.chromium.org/chromium/chromium/src/+/main:components/omnibox/browser/geolocation_header_service.cc;l=193;drc=c8b8e953163e6d035fc4e1bc4b32ec94c458dba8)

    Yifan Luo

    Done

    Line 1706, Patchset 6: if ((content_type == ContentSettingsType::GEOLOCATION_WITH_OPTIONS &&

    value == "block") ||
    (content_type != ContentSettingsType::GEOLOCATION_WITH_OPTIONS &&
    setting != PermissionSetting{CONTENT_SETTING_BLOCK})) {
    Antonio Sartori . resolved

    The way to do this easily is e.g.

    `PermissionSettingsRegistry::GetInstance()->Get(content_type)->delegate().IsBlocked(setting)`

    which works for all permissions.

    Yifan Luo

    Done

    Line 1727, Patchset 6: if (content_type != ContentSettingsType::GEOLOCATION_WITH_OPTIONS &&
    Antonio Sartori . unresolved

    just a note that this shouldn't be necessary anymore after https://crrev.com/c/7796856 lands

    Yifan Luo

    It looks like content_settings::ContentSettingToValue() can only take ContentSetting, if we don't check it ahead of time, it might cost error. Is there an existing function that we can convert PermissionSetting to value instead?

    Line 1737, Patchset 6: if (content_type != ContentSettingsType::GEOLOCATION_WITH_OPTIONS) {
    Antonio Sartori . resolved

    can you just check here if this is NOTIFICATIONS and remove that check from MaybeLogSafeBrowsing...?

    Otherwise pass a PermissionSetting to MaybeLog... and remove the check here.

    Yifan Luo

    Done

    Line 1791, Patchset 6: bool mute = (setting == PermissionSetting{CONTENT_SETTING_BLOCK}) ||
    Antonio Sartori . resolved

    let's just define `ContentSetting content_setting = std::get<ContentSetting>(setting)` here.

    Yifan Luo

    Done

    File chrome/browser/ui/webui/settings/site_settings_helper.cc
    Line 674, Patchset 6: if (base::FeatureList::IsEnabled(

    content_settings::features::kApproximateGeolocationPermission)) {
    base_types->push_back(ContentSettingsType::GEOLOCATION_WITH_OPTIONS);
    } else {
    base_types->push_back(ContentSettingsType::GEOLOCATION);
    }
    Antonio Sartori . resolved

    `base_types->push_back(content_settings::GeolocationContentSettingsType())`

    Yifan Luo

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Antonio Sartori
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ia4b88a05c18da191fe2367a79a8fafee8d3cea12
    Gerrit-Change-Number: 7782149
    Gerrit-PatchSet: 7
    Gerrit-Owner: Yifan Luo <l...@chromium.org>
    Gerrit-Reviewer: Antonio Sartori <antonio...@chromium.org>
    Gerrit-Reviewer: Yifan Luo <l...@chromium.org>
    Gerrit-Attention: Antonio Sartori <antonio...@chromium.org>
    Gerrit-Comment-Date: Tue, 05 May 2026 11:18:27 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Antonio Sartori <antonio...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Antonio Sartori (Gerrit)

    unread,
    7:29 AM (1 hour ago) 7:29 AM
    to Yifan Luo, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, asvitki...@chromium.org, jmedle...@chromium.org, srahim...@chromium.org, dullweb...@chromium.org, msrame...@chromium.org
    Attention needed from Yifan Luo

    Antonio Sartori added 1 comment

    File chrome/browser/ui/webui/settings/site_settings_handler.cc
    Line 1727, Patchset 6: if (content_type != ContentSettingsType::GEOLOCATION_WITH_OPTIONS &&
    Antonio Sartori . unresolved

    just a note that this shouldn't be necessary anymore after https://crrev.com/c/7796856 lands

    Yifan Luo

    It looks like content_settings::ContentSettingToValue() can only take ContentSetting, if we don't check it ahead of time, it might cost error. Is there an existing function that we can convert PermissionSetting to value instead?

    Attention is currently required from:
    • Yifan Luo
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ia4b88a05c18da191fe2367a79a8fafee8d3cea12
    Gerrit-Change-Number: 7782149
    Gerrit-PatchSet: 7
    Gerrit-Owner: Yifan Luo <l...@chromium.org>
    Gerrit-Reviewer: Antonio Sartori <antonio...@chromium.org>
    Gerrit-Reviewer: Yifan Luo <l...@chromium.org>
    Gerrit-Attention: Yifan Luo <l...@chromium.org>
    Gerrit-Comment-Date: Tue, 05 May 2026 11:28:41 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Yifan Luo <l...@chromium.org>
    Comment-In-Reply-To: Antonio Sartori <antonio...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages