Commit 13f4e724 authored by Rainhard Findling's avatar Rainhard Findling Committed by Chromium LUCI CQ

Privacy sandbox page: add entry point from Settings

Bug: 1152336
Change-Id: I3eefeca6ca9809d1275d970c5e22acb61a9a1740
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2596343Reviewed-by: default avatarRainhard Findling <rainhard@chromium.org>
Reviewed-by: default avatardpapad <dpapad@chromium.org>
Commit-Queue: Rainhard Findling <rainhard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#838439}
parent c0fe1d63
...@@ -11,6 +11,7 @@ NOTE: Chrome OS icons go in ./chromeos/os_icons.html. ...@@ -11,6 +11,7 @@ NOTE: Chrome OS icons go in ./chromeos/os_icons.html.
<defs> <defs>
<g id="credit-card"><path d="M16.4,4 L3.6,4 C2.716,4 2.008,4.7271875 2.008,5.625 L2,15.375 C2,16.2728125 2.716,17 3.6,17 L16.4,17 C17.284,17 18,16.2728125 18,15.375 L18,5.625 C18,4.7271875 17.284,4 16.4,4 Z M16.5,15 L3.5,15 L3.5,10 L16.5,10 L16.5,15 Z M16.5,7 L3.5,7 L3.5,5.5 L16.5,5.5 L16.5,7 Z"></path></g> <g id="credit-card"><path d="M16.4,4 L3.6,4 C2.716,4 2.008,4.7271875 2.008,5.625 L2,15.375 C2,16.2728125 2.716,17 3.6,17 L16.4,17 C17.284,17 18,16.2728125 18,15.375 L18,5.625 C18,4.7271875 17.284,4 16.4,4 Z M16.5,15 L3.5,15 L3.5,10 L16.5,10 L16.5,15 Z M16.5,7 L3.5,7 L3.5,5.5 L16.5,5.5 L16.5,7 Z"></path></g>
<g id="data"><path d="M0 0h20v20H0z" fill="none" fill-rule="evenodd"></path><path d="M6.5 7v9H4V7h2.5zm5-3v12H9V4h2.5zm5 7v5H14v-5h2.5z"></path></g> <g id="data"><path d="M0 0h20v20H0z" fill="none" fill-rule="evenodd"></path><path d="M6.5 7v9H4V7h2.5zm5-3v12H9V4h2.5zm5 7v5H14v-5h2.5z"></path></g>
<g id="experiment"><path d="M17.2667 14.7583L12.5 8.18332V4.23332H14.1667V2.56665H5.83332V4.23332H7.49998V8.17498L2.61665 14.9166C2.24998 15.425 2.19998 16.0917 2.48332 16.65C2.76665 17.2083 3.34165 17.5583 3.96665 17.5583H16.05C16.9667 17.5583 17.7167 16.8083 17.7167 15.8917C17.7167 15.4583 17.5416 15.0583 17.2667 14.7583Z" fill="#5F6368"></path></g>
<g id="googleg"><path d="M16.58 8H9v2.75h4.47c-.24 1.2-1.42 3.27-4.47 3.27-2.72 0-4.93-2.25-4.93-5.02S6.28 3.98 9 3.98c1.54 0 2.57.66 3.17 1.22l2.19-2.12C12.97 1.79 11.16 1 9 1 4.58 1 1 4.58 1 9s3.58 8 8 8c4.62 0 7.68-3.25 7.68-7.82 0-.46-.04-.83-.1-1.18z"></path></g> <g id="googleg"><path d="M16.58 8H9v2.75h4.47c-.24 1.2-1.42 3.27-4.47 3.27-2.72 0-4.93-2.25-4.93-5.02S6.28 3.98 9 3.98c1.54 0 2.57.66 3.17 1.22l2.19-2.12C12.97 1.79 11.16 1 9 1 4.58 1 1 4.58 1 9s3.58 8 8 8c4.62 0 7.68-3.25 7.68-7.82 0-.46-.04-.83-.1-1.18z"></path></g>
<g id="incognito" fill="#5F6368"><circle cx="6.8" cy="12.964" r="1.764"/><path d="M10 0C4.473 0 0 4.473 0 10s4.473 10 10 10 10-4.473 10-10S15.527 0 10 0zM7.619 4.1a.696.696 0 0 1 .881-.419l1.473.492 1.463-.492a.716.716 0 0 1 .883.419l1.608 4.291H6.02l1.6-4.291zm5.517 11.328a2.463 2.463 0 0 1-2.445-2.256c-.682-.436-1.237-.162-1.455-.017a2.45 2.45 0 0 1-2.445 2.263 2.471 2.471 0 0 1-2.464-2.463 2.47 2.47 0 0 1 2.463-2.464c1.165 0 2.138.809 2.391 1.9a1.934 1.934 0 0 1 1.546.009 2.462 2.462 0 0 1 2.392-1.909 2.47 2.47 0 0 1 2.462 2.463 2.435 2.435 0 0 1-2.445 2.474zM16.31 9.8H3.637v-.709H16.31V9.8h-.001z"/><circle cx="13.136" cy="12.964" r="1.764"/></g> <g id="incognito" fill="#5F6368"><circle cx="6.8" cy="12.964" r="1.764"/><path d="M10 0C4.473 0 0 4.473 0 10s4.473 10 10 10 10-4.473 10-10S15.527 0 10 0zM7.619 4.1a.696.696 0 0 1 .881-.419l1.473.492 1.463-.492a.716.716 0 0 1 .883.419l1.608 4.291H6.02l1.6-4.291zm5.517 11.328a2.463 2.463 0 0 1-2.445-2.256c-.682-.436-1.237-.162-1.455-.017a2.45 2.45 0 0 1-2.445 2.263 2.471 2.471 0 0 1-2.464-2.463 2.47 2.47 0 0 1 2.463-2.464c1.165 0 2.138.809 2.391 1.9a1.934 1.934 0 0 1 1.546.009 2.462 2.462 0 0 1 2.392-1.909 2.47 2.47 0 0 1 2.462 2.463 2.435 2.435 0 0 1-2.445 2.474zM16.31 9.8H3.637v-.709H16.31V9.8h-.001z"/><circle cx="13.136" cy="12.964" r="1.764"/></g>
<g id="location-on"><path d="M10,2 C6.95928571,2 4.5,4.504 4.5,7.6 C4.5,11.8 10,18 10,18 C10,18 15.5,11.8 15.5,7.6 C15.5,4.504 13.0407143,2 10,2 Z M10,9.5 C8.896,9.5 8,8.604 8,7.5 C8,6.396 8.896,5.5 10,5.5 C11.104,5.5 12,6.396 12,7.5 C12,8.604 11.104,9.5 10,9.5 Z"></path></g> <g id="location-on"><path d="M10,2 C6.95928571,2 4.5,4.504 4.5,7.6 C4.5,11.8 10,18 10,18 C10,18 15.5,11.8 15.5,7.6 C15.5,4.504 13.0407143,2 10,2 Z M10,9.5 C8.896,9.5 8,8.604 8,7.5 C8,6.396 8.896,5.5 10,5.5 C11.104,5.5 12,6.396 12,7.5 C12,8.604 11.104,9.5 10,9.5 Z"></path></g>
......
...@@ -49,6 +49,15 @@ ...@@ -49,6 +49,15 @@
sub-label="$i18n{permissionsPageDescription}" sub-label="$i18n{permissionsPageDescription}"
on-click="onPermissionsPageClick_" on-click="onPermissionsPageClick_"
role-description="$i18n{subpageArrowRoleDescription}"></cr-link-row> role-description="$i18n{subpageArrowRoleDescription}"></cr-link-row>
<cr-link-row id="privacySandboxLinkRow"
start-icon="settings20:experiment"
class="hr"
label="$i18n{privacySandboxTitle}"
sub-label="$i18n{privacySandboxTitle}"
on-click="onPrivacySandboxClick_"
hidden="[[!enablePrivacySandboxSettings_]]"
external
role-description="$i18n{subpageArrowRoleDescription}"></cr-link-row>
</div> </div>
<if expr="use_nss_certs"> <if expr="use_nss_certs">
......
...@@ -165,6 +165,12 @@ Polymer({ ...@@ -165,6 +165,12 @@ Polymer({
loadTimeData.getBoolean('enableWebBluetoothNewPermissionsBackend'), loadTimeData.getBoolean('enableWebBluetoothNewPermissionsBackend'),
}, },
/** @private */
enablePrivacySandboxSettings_: {
type: Boolean,
value: () => loadTimeData.getBoolean('privacySandboxSettingsEnabled'),
},
/** @private {!Map<string, string>} */ /** @private {!Map<string, string>} */
focusConfig_: { focusConfig_: {
type: Object, type: Object,
...@@ -328,6 +334,13 @@ Polymer({ ...@@ -328,6 +334,13 @@ Polymer({
Router.getInstance().navigateTo(routes.SECURITY); Router.getInstance().navigateTo(routes.SECURITY);
}, },
/** @private */
onPrivacySandboxClick_() {
// TODO(crbug/1159942): Replace this with an ordinary OpenWindowProxy call
// once crbug/1159942 is fixed.
window.location = 'chrome://settings/privacySandbox';
},
/** @private */ /** @private */
getProtectedContentLabel_(value) { getProtectedContentLabel_(value) {
return value ? this.i18n('siteSettingsProtectedContentEnable') : return value ? this.i18n('siteSettingsProtectedContentEnable') :
......
...@@ -1444,13 +1444,22 @@ void AddPrivacyStrings(content::WebUIDataSource* html_source, ...@@ -1444,13 +1444,22 @@ void AddPrivacyStrings(content::WebUIDataSource* html_source,
} }
void AddPrivacySandboxStrings(content::WebUIDataSource* html_source) { void AddPrivacySandboxStrings(content::WebUIDataSource* html_source) {
// Strings that need to be available in any case.
static constexpr webui::LocalizedString kLocalizedStrings[] = { static constexpr webui::LocalizedString kLocalizedStrings[] = {
{"privacySandboxTitle", IDS_SETTINGS_PRIVACY_SANDBOX_TITLE}, {"privacySandboxTitle", IDS_SETTINGS_PRIVACY_SANDBOX_TITLE},
{"privacySandboxPageHeading", IDS_SETTINGS_PRIVACY_SANDBOX_PAGE_HEADING},
}; };
AddLocalizedStringsBulk(html_source, kLocalizedStrings); AddLocalizedStringsBulk(html_source, kLocalizedStrings);
html_source->AddString("privacySandboxURL", chrome::kPrivacySandboxURL); // Strings that only need to be available when the flag is enabled.
if (base::FeatureList::IsEnabled(features::kPrivacySandboxSettings)) {
static constexpr webui::LocalizedString kLocalizedStringsBehindFlag[] = {
{"privacySandboxPageHeading",
IDS_SETTINGS_PRIVACY_SANDBOX_PAGE_HEADING},
};
AddLocalizedStringsBulk(html_source, kLocalizedStringsBehindFlag);
html_source->AddString("privacySandboxURL", chrome::kPrivacySandboxURL);
}
} }
void AddSafetyCheckStrings(content::WebUIDataSource* html_source) { void AddSafetyCheckStrings(content::WebUIDataSource* html_source) {
...@@ -2434,6 +2443,7 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source, ...@@ -2434,6 +2443,7 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source,
AddLanguagesStrings(html_source, profile); AddLanguagesStrings(html_source, profile);
AddOnStartupStrings(html_source); AddOnStartupStrings(html_source);
AddPeopleStrings(html_source, profile); AddPeopleStrings(html_source, profile);
AddPrivacySandboxStrings(html_source);
AddPrivacyStrings(html_source, profile); AddPrivacyStrings(html_source, profile);
AddSafetyCheckStrings(html_source); AddSafetyCheckStrings(html_source);
AddResetStrings(html_source, profile); AddResetStrings(html_source, profile);
...@@ -2442,9 +2452,6 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source, ...@@ -2442,9 +2452,6 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source,
AddSearchStrings(html_source); AddSearchStrings(html_source);
AddSiteSettingsStrings(html_source, profile); AddSiteSettingsStrings(html_source, profile);
if (base::FeatureList::IsEnabled(features::kPrivacySandboxSettings))
AddPrivacySandboxStrings(html_source);
#if BUILDFLAG(IS_CHROMEOS_ASH) #if BUILDFLAG(IS_CHROMEOS_ASH)
AddChromeOSUserStrings(html_source, profile); AddChromeOSUserStrings(html_source, profile);
#else #else
......
...@@ -318,6 +318,10 @@ SettingsUI::SettingsUI(content::WebUI* web_ui) ...@@ -318,6 +318,10 @@ SettingsUI::SettingsUI(content::WebUI* web_ui)
"safetyCheckWeakPasswordsEnabled", "safetyCheckWeakPasswordsEnabled",
base::FeatureList::IsEnabled(features::kSafetyCheckWeakPasswords)); base::FeatureList::IsEnabled(features::kSafetyCheckWeakPasswords));
html_source->AddBoolean(
"privacySandboxSettingsEnabled",
base::FeatureList::IsEnabled(features::kPrivacySandboxSettings));
AddSettingsPageUIHandler(std::make_unique<AboutHandler>(profile)); AddSettingsPageUIHandler(std::make_unique<AboutHandler>(profile));
AddSettingsPageUIHandler(std::make_unique<ResetSettingsHandler>(profile)); AddSettingsPageUIHandler(std::make_unique<ResetSettingsHandler>(profile));
......
...@@ -377,6 +377,11 @@ var CrSettingsPrivacyPageV3Test = class extends CrSettingsV3BrowserTest { ...@@ -377,6 +377,11 @@ var CrSettingsPrivacyPageV3Test = class extends CrSettingsV3BrowserTest {
get browsePreload() { get browsePreload() {
return 'chrome://settings/test_loader.html?module=settings/privacy_page_test.js'; return 'chrome://settings/test_loader.html?module=settings/privacy_page_test.js';
} }
/** @override */
get featureList() {
return {enabled: ['features::kPrivacySandboxSettings']};
}
}; };
TEST_F('CrSettingsPrivacyPageV3Test', 'PrivacyPageTests', function() { TEST_F('CrSettingsPrivacyPageV3Test', 'PrivacyPageTests', function() {
......
...@@ -78,6 +78,7 @@ suite('PrivacyPage', function() { ...@@ -78,6 +78,7 @@ suite('PrivacyPage', function() {
suiteSetup(function() { suiteSetup(function() {
loadTimeData.overrideValues({ loadTimeData.overrideValues({
enableContentSettingsRedesign: false, enableContentSettingsRedesign: false,
privacySandboxSettingsEnabled: false,
}); });
}); });
...@@ -153,8 +154,27 @@ suite('PrivacyPage', function() { ...@@ -153,8 +154,27 @@ suite('PrivacyPage', function() {
0); 0);
assertFalse(isChildVisible(page, '#notficationRadioGroup')); assertFalse(isChildVisible(page, '#notficationRadioGroup'));
}); });
test('privacySandboxRowNotVisible', function() {
assertFalse(isChildVisible(page, '#privacySandboxLinkRow'));
});
}); });
suite('PrivacySandboxSettingsEnabled', function() {
/** @type {!SettingsPrivacyPageElement} */
let page;
setup(function() {
document.body.innerHTML = '';
page = /** @type {!SettingsPrivacyPageElement} */
(document.createElement('settings-privacy-page'));
document.body.appendChild(page);
});
test('privacySandboxRowVisible', function() {
assertTrue(isChildVisible(page, '#privacySandboxLinkRow'));
});
});
suite('ContentSettingsRedesign', function() { suite('ContentSettingsRedesign', function() {
/** @type {!SettingsPrivacyPageElement} */ /** @type {!SettingsPrivacyPageElement} */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment