Commit 0575afe8 authored by sauski's avatar sauski Committed by Chromium LUCI CQ

Privacy Sandbox: Initial page framework

Adds new, almost empty, WebUI page at chrome://settings/privacySandbox,
which is built to enable access to existing chrome://settings resources.

This is a standalone HTML page separate from the main chrome://settings
SPA, but served from the same WebUI controller. This allows it to access
resources directly via chrome://settings/[settings.js,lazy_load.js]

Skipping string check as adding screenshots without context is of low
value.

Skip-Translation-Screenshots-Check: True
Bug: 1152336
Change-Id: I084b57ea51ab750604cd14563b4e688e7c35133e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2557502
Commit-Queue: Theodore Olsauskas-Warren <sauski@google.com>
Reviewed-by: default avatardpapad <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832411}
parent bc5fec21
...@@ -1142,6 +1142,14 @@ ...@@ -1142,6 +1142,14 @@
More More
</message> </message>
<!-- Privacy Sandbox -->
<message name="IDS_SETTINGS_PRIVACY_SANDBOX_TITLE" desc="The title of the Privacy Sandbox page">
Privacy Sandbox
</message>
<message name="IDS_SETTINGS_PRIVACY_SANDBOX_PAGE_HEADING" desc="The heading displayed at the top of the Privacy Sandbox page">
The Privacy Sandbox
</message>
<!-- Safety check --> <!-- Safety check -->
<message name="IDS_SETTINGS_SAFETY_CHECK_SECTION_TITLE" desc="'Safety check' is a noun phrase (sentence case). 'Safety check' refers to an area of the Settings page where users can quickly check whether their safety-related settings are fully protecting them."> <message name="IDS_SETTINGS_SAFETY_CHECK_SECTION_TITLE" desc="'Safety check' is a noun phrase (sentence case). 'Safety check' refers to an area of the Settings page where users can quickly check whether their safety-related settings are fully protecting them.">
Safety check Safety check
......
...@@ -65,19 +65,23 @@ generate_grd("build_grd") { ...@@ -65,19 +65,23 @@ generate_grd("build_grd") {
"images/safe_browsing_banner.svg", "images/safe_browsing_banner.svg",
"images/sync_banner_dark.svg", "images/sync_banner_dark.svg",
"images/sync_banner.svg", "images/sync_banner.svg",
"privacy_sandbox/privacy_sandbox.html",
"settings.html", "settings.html",
] ]
input_files_base_dir = rebase_path(".", "//") input_files_base_dir = rebase_path(".", "//")
grdp_files = [ "$target_gen_dir/privacy_sandbox/resources.grdp" ]
deps = [ "privacy_sandbox:build_grdp" ]
if (optimize_webui) { if (optimize_webui) {
deps = [ ":build" ] deps += [ ":build" ]
manifest_files = [ "$target_gen_dir/$build_manifest" ] manifest_files = [ "$target_gen_dir/$build_manifest" ]
resource_path_rewrites = [ resource_path_rewrites = [
"settings.rollup.js|settings.js", "settings.rollup.js|settings.js",
"lazy_load.rollup.js|lazy_load.js", "lazy_load.rollup.js|lazy_load.js",
] ]
} else { } else {
deps = [ deps += [
":preprocess", ":preprocess",
":preprocess_generated", ":preprocess_generated",
] ]
...@@ -355,6 +359,7 @@ group("closure_compile") { ...@@ -355,6 +359,7 @@ group("closure_compile") {
"people_page:closure_compile", "people_page:closure_compile",
"prefs:closure_compile", "prefs:closure_compile",
"privacy_page:closure_compile", "privacy_page:closure_compile",
"privacy_sandbox:closure_compile",
"search_engines_page:closure_compile", "search_engines_page:closure_compile",
"settings_page:closure_compile", "settings_page:closure_compile",
] ]
......
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//third_party/closure_compiler/compile_js.gni")
import("//tools/polymer/html_to_js.gni")
import("//ui/webui/resources/tools/generate_grd.gni")
import("../settings.gni")
generate_grd("build_grdp") {
grd_prefix = "privacy_sandbox"
out_grd = "$target_gen_dir/resources.grdp"
deps = [ ":web_components" ]
input_files_base_dir = rebase_path(target_gen_dir, root_build_dir)
input_files = [ "app.js" ]
resource_path_prefix = "privacy_sandbox"
}
js_type_check("closure_compile") {
is_polymer3 = true
closure_flags = settings_closure_flags
deps = [ ":app" ]
}
js_library("app") {
deps = [
"//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
]
}
html_to_js("web_components") {
js_files = [ "app.js" ]
}
sauski@google.com
# COMPONENT: UI>Settings>Privacy
# TEAM: chrome-friendly-settings@google.com
<style include="cr-shared-style">
#page-heading {
font-size: 2rem;
font-weight: 200;
margin: 0;
padding: 28px 0 14px 0;
text-align: center;
}
</style>
<div class="cr-centered-card-container">
<h1 id="page-heading">$i18n{privacySandboxPageHeading}</h1>
</div>
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'chrome://resources/cr_elements/shared_style_css.m.js';
import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
Polymer({
is: 'privacy-sandbox-app',
_template: html`{__html_template__}`,
});
<!DOCTYPE html>
<html dir="$i18n{textdirection}" lang="$i18n{language}">
<head>
<meta charset="utf-8">
<meta name="color-scheme" content="light dark">
<title>$i18n{privacySandboxTitle}</title>
<link rel="stylesheet" href="chrome://resources/css/md_colors.css">
<style>
html {
background: var(--md-background-color);
height: 100%;
}
html,
body {
height: 100%;
margin: 0;
}
</style>
</head>
<body>
<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
<script type="module" src="privacy_sandbox/app.js"></script>
<privacy-sandbox-app></privacy-sandbox-app>
</body>
</html>
...@@ -1436,6 +1436,14 @@ void AddPrivacyStrings(content::WebUIDataSource* html_source, ...@@ -1436,6 +1436,14 @@ void AddPrivacyStrings(content::WebUIDataSource* html_source,
AddPersonalizationOptionsStrings(html_source); AddPersonalizationOptionsStrings(html_source);
} }
void AddPrivacySandboxStrings(content::WebUIDataSource* html_source) {
static constexpr webui::LocalizedString kLocalizedStrings[] = {
{"privacySandboxTitle", IDS_SETTINGS_PRIVACY_SANDBOX_TITLE},
{"privacySandboxPageHeading", IDS_SETTINGS_PRIVACY_SANDBOX_PAGE_HEADING},
};
AddLocalizedStringsBulk(html_source, kLocalizedStrings);
}
void AddSafetyCheckStrings(content::WebUIDataSource* html_source) { void AddSafetyCheckStrings(content::WebUIDataSource* html_source) {
static constexpr webui::LocalizedString kLocalizedStrings[] = { static constexpr webui::LocalizedString kLocalizedStrings[] = {
{"safetyCheckSectionTitle", IDS_SETTINGS_SAFETY_CHECK_SECTION_TITLE}, {"safetyCheckSectionTitle", IDS_SETTINGS_SAFETY_CHECK_SECTION_TITLE},
...@@ -2425,6 +2433,9 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source, ...@@ -2425,6 +2433,9 @@ 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
......
...@@ -346,6 +346,11 @@ SettingsUI::SettingsUI(content::WebUI* web_ui) ...@@ -346,6 +346,11 @@ SettingsUI::SettingsUI(content::WebUI* web_ui)
profile, std::make_unique<FaviconSource>( profile, std::make_unique<FaviconSource>(
profile, chrome::FaviconUrlFormat::kFavicon2)); profile, chrome::FaviconUrlFormat::kFavicon2));
// Privacy Sandbox
if (base::FeatureList::IsEnabled(features::kPrivacySandboxSettings)) {
html_source->AddResourcePath(
"privacySandbox", IDR_SETTINGS_PRIVACY_SANDBOX_PRIVACY_SANDBOX_HTML);
}
TryShowHatsSurveyWithTimeout(); TryShowHatsSurveyWithTimeout();
} }
......
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