Files
cromite/build/patches/00WIN-ADDTO-Timezone-customization.patch
T
2023-03-30 14:32:09 +02:00

255 lines
16 KiB
Diff

From: Your Name <you@example.com>
Date: Wed, 12 Oct 2022 16:03:16 +0000
Subject: WIN ADDTO Timezone customization
---
chrome/app/settings_strings.grdp | 19 ++++++++++++++++
chrome/browser/resources/settings/icons.html | 2 ++
.../settings/privacy_page/privacy_page.html | 22 +++++++++++++++++++
chrome/browser/resources/settings/route.ts | 1 +
chrome/browser/resources/settings/router.ts | 1 +
.../site_settings/category_default_setting.ts | 1 +
.../settings/site_settings/constants.ts | 1 +
.../settings_category_default_radio_group.ts | 1 +
.../settings/site_settings/site_details.html | 5 +++++
.../site_settings_page/site_settings_page.ts | 9 ++++++++
.../site_settings_page_util.ts | 2 ++
.../views/page_info/page_info_view_factory.cc | 3 +++
.../settings_localized_strings_provider.cc | 7 ++++++
.../ui/webui/settings/site_settings_helper.cc | 1 +
.../core/browser/content_settings_registry.cc | 2 +-
15 files changed, 76 insertions(+), 1 deletion(-)
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp
--- a/chrome/app/settings_strings.grdp
+++ b/chrome/app/settings_strings.grdp
@@ -4259,6 +4259,25 @@
Not allowed to Javascript JIT
</message>
+ <message name="IDS_SITE_SETTINGS_TIMEZONE_OVERRIDE_TITLE" desc="Description of the timezone override content setting page title.">
+ Timezone override
+ </message>
+ <message name="IDS_SETTINGS_SITE_SETTINGS_TIMEZONE_OVERRIDE_DESCRIPTION" desc="Description of the timezone override content setting.">
+ Enable the Timezone override
+ </message>
+ <message name="IDS_SETTINGS_SITE_SETTINGS_TIMEZONE_OVERRIDE_ALLOWED" desc="Label for the enabled option of the timezone override setting.">
+ System Timezone
+ </message>
+ <message name="IDS_SETTINGS_SITE_SETTINGS_TIMEZONE_OVERRIDE_BLOCKED" desc="Label for the disabled option of the timezone override setting.">
+ Random Timezone
+ </message>
+ <message name="IDS_SETTINGS_SITE_SETTINGS_TIMEZONE_OVERRIDE_ALLOWED_EXCEPTIONS" desc="Label for the allowed exceptions site list of the timezone override setting.">
+ System Timezone override
+ </message>
+ <message name="IDS_SETTINGS_SITE_SETTINGS_TIMEZONE_OVERRIDE_BLOCKED_EXCEPTIONS" desc="Label for the blocked exceptions site list of the timezone override setting.">
+ Random Timezone override
+ </message>
+
<if expr="not is_chromeos">
<!-- Import Settings Dialog -->
<message name="IDS_SETTINGS_IMPORT_SETTINGS_TITLE" desc="Dialog title for import dialog.">
diff --git a/chrome/browser/resources/settings/icons.html b/chrome/browser/resources/settings/icons.html
--- a/chrome/browser/resources/settings/icons.html
+++ b/chrome/browser/resources/settings/icons.html
@@ -193,6 +193,8 @@ NOTE: Chrome OS icons go in ./chromeos/os_icons.html.
<g id="autoplay-off"><path d="M16.25,13.42C16.4,12.97,16.5,12.5,16.5,12c0-1.77-1.02-3.29-2.5-4.03v3.2L16.25,13.42z"></path><path d="M19,12c0,1.21-0.31,2.34-0.85,3.32l1.46,1.46C20.48,15.39,21,13.76,21,12c0-4.28-2.99-7.86-7-8.77v2.06 C16.89,6.15,19,8.83,19,12z"></path><path d="M2.81,2.81L1.39,4.22L6.17,9H3v6h4l5,5v-5.17l3.32,3.32c-0.42,0.23-0.85,0.43-1.32,0.56v2.06c1-0.23,1.94-0.62,2.79-1.15 l2.99,2.99l1.41-1.41L2.81,2.81z"></path><polygon points="12,9.17 12,4 9.41,6.59"></polygon></g>
<g id="javascript-jit"><path d="M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"></path></g>
<g id="javascript-jit-off"><path d="M19.17,12l-4.58-4.59L16,6l6,6l-3.59,3.59L17,14.17L19.17,12z M1.39,4.22l4.19,4.19L2,12l6,6l1.41-1.41L4.83,12L7,9.83 l12.78,12.78l1.41-1.41L2.81,2.81L1.39,4.22z"></path></g>
+ <g id="timezone-override"><path d="M21.72 11.33l-6.644-7.035a.97.97 0 0 0-1.38-.01l-1.67 1.72-1.617-1.712a.97.97 0 0 0-1.38-.01l-6.737 6.935c-.187.191-.29.447-.292.719-.002.272.099.529.28.722l6.644 7.034a.949.949 0 0 0 1.38.011l1.671-1.718 1.615 1.71a.949.949 0 0 0 1.381.01l6.74-6.935a1.054 1.054 0 0 0 .01-1.44zM6.947 12.464l3.657 3.785-.974.98-5.273-5.456 5.349-5.378.929.962-3.677 3.7a.998.998 0 0 0-.292.702 1 1 0 0 0 .28.705zm7.35 4.768l-.931-.963 3.68-3.7a1.012 1.012 0 0 0 .007-1.407l-3.656-3.784.974-.98 5.273 5.456-5.348 5.378z"></path></g>
+ <g id="timezone-override-off"><path d="M7.95,5.12l0.73-0.8C8.88,4.11,9.15,4,9.42,4c0.27,0,0.54,0.11,0.74,0.32L12,6.34l1.85-2.01C14.04,4.11,14.31,4,14.58,4 c0.27,0,0.54,0.11,0.74,0.32l6.42,7c0.35,0.38,0.35,0.97,0,1.35l-2.98,3.25l-1.42-1.42l2.3-2.51l-5.06-5.52l-1.23,1.34l3.21,3.51 c0.35,0.38,0.35,0.97,0,1.35l-0.51,0.56L7.95,5.12z M19.78,22.61l-3.73-3.73l-0.73,0.8c-0.2,0.22-0.47,0.32-0.74,0.32 c-0.27,0-0.54-0.11-0.74-0.32L12,17.66l-1.85,2.01C9.96,19.89,9.69,20,9.42,20c-0.27,0-0.54-0.11-0.74-0.32l-6.42-7 c-0.35-0.38-0.35-0.97,0-1.35l2.98-3.25L1.39,4.22l1.41-1.41l18.38,18.38L19.78,22.61z M10.64,16.18l-3.21-3.51 c-0.35-0.38-0.35-0.97,0-1.35l0.51-0.56L6.66,9.49L4.36,12l5.06,5.52L10.64,16.18z"></path></g>
</defs>
</svg>
</iron-iconset-svg>
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_page.html b/chrome/browser/resources/settings/privacy_page/privacy_page.html
--- a/chrome/browser/resources/settings/privacy_page/privacy_page.html
+++ b/chrome/browser/resources/settings/privacy_page/privacy_page.html
@@ -1147,4 +1147,26 @@
</category-setting-exceptions>
</settings-subpage>
</template>
+ <template is="dom-if" route-path="/content/timezone-override" no-search>
+ <settings-subpage page-title="$i18n{siteSettingsTimezoneOverride}"
+ search-label="$i18n{siteSettingsAllSitesSearch}"
+ search-term="{{searchFilter_}}">
+ <div class="content-settings-header secondary">
+ $i18n{siteSettingsTimezoneOverrideDescription}
+ </div>
+ <settings-category-default-radio-group
+ category="[[contentSettingsTypesEnum_.TIMEZONE_OVERRIDE]]"
+ allow-option-label="$i18n{siteSettingsTimezoneOverrideAllowed}"
+ allow-option-icon="settings:timezone-override"
+ block-option-label="$i18n{siteSettingsTimezoneOverrideBlocked}"
+ block-option-icon="settings:timezone-override-off">
+ </settings-category-default-radio-group>
+ <category-setting-exceptions
+ category="[[contentSettingsTypesEnum_.TIMEZONE_OVERRIDE]]"
+ block-header="$i18n{siteSettingsTimezoneOverrideBlockedExceptions}"
+ allow-header="$i18n{siteSettingsTimezoneOverrideAllowedExceptions}"
+ search-filter="[[searchFilter_]]">
+ </category-setting-exceptions>
+ </settings-subpage>
+ </template>
</settings-animated-pages>
diff --git a/chrome/browser/resources/settings/route.ts b/chrome/browser/resources/settings/route.ts
--- a/chrome/browser/resources/settings/route.ts
+++ b/chrome/browser/resources/settings/route.ts
@@ -116,6 +116,7 @@ function addPrivacyChildRoutes(r: Partial<SettingsRoutes>) {
r.SITE_SETTINGS_LOCAL_FONTS = r.SITE_SETTINGS.createChild('localFonts');
r.SITE_SETTINGS_AUTOPLAY = r.SITE_SETTINGS.createChild('autoplay');
r.SITE_SETTINGS_JAVASCRIPT_JIT = r.SITE_SETTINGS.createChild('javascript-jit');
+ r.SITE_SETTINGS_TIMEZONE_OVERRIDE = r.SITE_SETTINGS.createChild('timezone-override');
}
/**
diff --git a/chrome/browser/resources/settings/router.ts b/chrome/browser/resources/settings/router.ts
--- a/chrome/browser/resources/settings/router.ts
+++ b/chrome/browser/resources/settings/router.ts
@@ -103,6 +103,7 @@ export interface SettingsRoutes {
TRIGGERED_RESET_DIALOG: Route;
SITE_SETTINGS_AUTOPLAY: Route;
SITE_SETTINGS_JAVASCRIPT_JIT: Route;
+ SITE_SETTINGS_TIMEZONE_OVERRIDE: Route;
}
/** Class for navigable routes. */
diff --git a/chrome/browser/resources/settings/site_settings/category_default_setting.ts b/chrome/browser/resources/settings/site_settings/category_default_setting.ts
--- a/chrome/browser/resources/settings/site_settings/category_default_setting.ts
+++ b/chrome/browser/resources/settings/site_settings/category_default_setting.ts
@@ -197,6 +197,7 @@ export class CategoryDefaultSettingElement extends
case ContentSettingsTypes.SOUND:
case ContentSettingsTypes.AUTOPLAY:
case ContentSettingsTypes.JAVASCRIPT_JIT:
+ case ContentSettingsTypes.TIMEZONE_OVERRIDE:
// "Allowed" vs "Blocked".
this.browserProxy.setDefaultValueForContentType(
this.category,
diff --git a/chrome/browser/resources/settings/site_settings/constants.ts b/chrome/browser/resources/settings/site_settings/constants.ts
--- a/chrome/browser/resources/settings/site_settings/constants.ts
+++ b/chrome/browser/resources/settings/site_settings/constants.ts
@@ -48,6 +48,7 @@ export enum ContentSettingsTypes {
ZOOM_LEVELS = 'zoom-levels',
AUTOPLAY = 'autoplay',
JAVASCRIPT_JIT = 'javascript-jit',
+ TIMEZONE_OVERRIDE = 'timezone-override',
// The following items are not in the C++ kContentSettingsTypeGroupNames, but
// are used everywhere where ContentSettingsTypes is used in JS.
diff --git a/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts b/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts
--- a/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts
+++ b/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts
@@ -141,6 +141,7 @@ export class SettingsCategoryDefaultRadioGroupElement extends
case ContentSettingsTypes.SOUND:
case ContentSettingsTypes.AUTOPLAY:
case ContentSettingsTypes.JAVASCRIPT_JIT:
+ case ContentSettingsTypes.TIMEZONE_OVERRIDE:
// "Allowed" vs "Blocked".
return ContentSetting.ALLOW;
case ContentSettingsTypes.AR:
diff --git a/chrome/browser/resources/settings/site_settings/site_details.html b/chrome/browser/resources/settings/site_settings/site_details.html
--- a/chrome/browser/resources/settings/site_settings/site_details.html
+++ b/chrome/browser/resources/settings/site_settings/site_details.html
@@ -276,4 +276,9 @@
icon="settings:javascript-jit"
label="$i18n{siteSettingsJavascriptJIT}">
</site-details-permission>
+ <site-details-permission
+ category="[[contentSettingsTypesEnum_.TIMEZONE_OVERRIDE]]"
+ icon="settings:timezone-override"
+ label="$i18n{siteSettingsTimezoneOverride}">
+ </site-details-permission>
</div>
diff --git a/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts b/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts
--- a/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts
+++ b/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts
@@ -350,6 +350,14 @@ function getCategoryItemMap(): Map<ContentSettingsTypes, CategoryListItem> {
enabledLabel: 'siteSettingsJavascriptJITAllowed',
disabledLabel: 'siteSettingsJavascriptJITBlocked',
},
+ {
+ route: routes.SITE_SETTINGS_TIMEZONE_OVERRIDE,
+ id: Id.TIMEZONE_OVERRIDE,
+ label: 'siteSettingsTimezoneOverride',
+ icon: 'settings:timezone-override',
+ enabledLabel: 'siteSettingsTimezoneOverrideAllowed',
+ disabledLabel: 'siteSettingsTimezoneOverrideBlocked',
+ },
];
categoryItemMap = new Map(categoryList.map(item => [item.id, item]));
@@ -445,6 +453,7 @@ export class SettingsSiteSettingsPageElement extends
Id.SITE_DATA,
Id.AUTOPLAY,
Id.JAVASCRIPT_JIT,
+ Id.TIMEZONE_OVERRIDE,
]),
};
},
diff --git a/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts b/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts
--- a/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts
+++ b/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts
@@ -81,6 +81,8 @@ export function getLocalizationStringForContentType(
return 'siteSettingsAutoplayMidSentence';
case ContentSettingsTypes.JAVASCRIPT_JIT:
return 'siteSettingsJavascriptJITMidSentence';
+ case ContentSettingsTypes.TIMEZONE_OVERRIDE:
+ return 'siteSettingsTimezoneOverrideMidSentence';
// The following members do not have a mid-sentence localization.
case ContentSettingsTypes.ANTI_ABUSE:
case ContentSettingsTypes.PDF_DOCUMENTS:
diff --git a/chrome/browser/ui/views/page_info/page_info_view_factory.cc b/chrome/browser/ui/views/page_info/page_info_view_factory.cc
--- a/chrome/browser/ui/views/page_info/page_info_view_factory.cc
+++ b/chrome/browser/ui/views/page_info/page_info_view_factory.cc
@@ -344,6 +344,9 @@ const ui::ImageModel PageInfoViewFactory::GetPermissionIcon(
case ContentSettingsType::JAVASCRIPT_JIT:
icon = &vector_icons::kCodeIcon;
break;
+ case ContentSettingsType::TIMEZONE_OVERRIDE:
+ icon = &vector_icons::kAccountCircleIcon;
+ break;
default:
// All other |ContentSettingsType|s do not have icons on desktop or are
// not shown in the Page Info bubble.
diff --git a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
--- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -2434,6 +2434,13 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
{"siteSettingsJavascriptJITAllowedExceptions",IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_ALLOWED_EXCEPTIONS},
{"siteSettingsJavascriptJITBlockedExceptions", IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_BLOCKED_EXCEPTIONS},
{"siteSettingsJavascriptJITMidSentence", IDS_SITE_SETTINGS_TYPE_JAVASCRIPT_JIT},
+ {"siteSettingsTimezoneOverride", IDS_SITE_SETTINGS_TIMEZONE_OVERRIDE_TITLE},
+ {"siteSettingsTimezoneOverrideDescription", IDS_SETTINGS_SITE_SETTINGS_TIMEZONE_OVERRIDE_DESCRIPTION},
+ {"siteSettingsTimezoneOverrideAllowed", IDS_SETTINGS_SITE_SETTINGS_TIMEZONE_OVERRIDE_ALLOWED},
+ {"siteSettingsTimezoneOverrideBlocked", IDS_SETTINGS_SITE_SETTINGS_TIMEZONE_OVERRIDE_BLOCKED},
+ {"siteSettingsTimezoneOverrideAllowedExceptions",IDS_SETTINGS_SITE_SETTINGS_TIMEZONE_OVERRIDE_ALLOWED_EXCEPTIONS},
+ {"siteSettingsTimezoneOverrideBlockedExceptions", IDS_SETTINGS_SITE_SETTINGS_TIMEZONE_OVERRIDE_BLOCKED_EXCEPTIONS},
+ {"siteSettingsTimezoneOverrideMidSentence", IDS_SITE_SETTINGS_TIMEZONE_OVERRIDE_TITLE},
{"addSite", IDS_SETTINGS_ADD_SITE},
{"addSiteTitle", IDS_SETTINGS_ADD_SITE_TITLE},
#if BUILDFLAG(IS_CHROMEOS_ASH)
diff --git a/chrome/browser/ui/webui/settings/site_settings_helper.cc b/chrome/browser/ui/webui/settings/site_settings_helper.cc
--- a/chrome/browser/ui/webui/settings/site_settings_helper.cc
+++ b/chrome/browser/ui/webui/settings/site_settings_helper.cc
@@ -127,6 +127,7 @@ const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = {
{ContentSettingsType::ANTI_ABUSE, "anti-abuse"},
{ContentSettingsType::AUTOPLAY, "autoplay"},
{ContentSettingsType::JAVASCRIPT_JIT, "javascript-jit"},
+ {ContentSettingsType::TIMEZONE_OVERRIDE, "timezone-override"},
// Add new content settings here if a corresponding Javascript string
// representation for it is not required, for example if the content setting
diff --git a/components/content_settings/core/browser/content_settings_registry.cc b/components/content_settings/core/browser/content_settings_registry.cc
--- a/components/content_settings/core/browser/content_settings_registry.cc
+++ b/components/content_settings/core/browser/content_settings_registry.cc
@@ -570,7 +570,7 @@ void ContentSettingsRegistry::Init() {
CONTENT_SETTING_ASK, // custom timezone, default UTC
CONTENT_SETTING_BLOCK}, // random
WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE,
- WebsiteSettingsRegistry::PLATFORM_ANDROID,
+ WebsiteSettingsRegistry::ALL_PLATFORMS,
ContentSettingsInfo::INHERIT_IN_INCOGNITO,
ContentSettingsInfo::EXCEPTIONS_ON_SECURE_AND_INSECURE_ORIGINS);
--
2.25.1